0
0
R Programmingprogramming~10 mins

Excel files with readxl in R Programming - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to load the readxl package.

R Programming
library([1])
Drag options to blanks, or click blank then click option'
Areadxl
Bggplot2
Ctidyr
Ddplyr
Attempts:
3 left
💡 Hint
Common Mistakes
Loading a different package like dplyr or ggplot2 instead of readxl.
2fill in blank
medium

Complete the code to read an Excel file named 'data.xlsx'.

R Programming
df <- read_excel([1])
Drag options to blanks, or click blank then click option'
Adata.csv
B'data.csv'
Cdata.xlsx
D'data.xlsx'
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes around the file name.
Using the wrong file extension like .csv instead of .xlsx.
3fill in blank
hard

Fix the error in the code to read the second sheet of an Excel file.

R Programming
df <- read_excel('data.xlsx', sheet = [1])
Drag options to blanks, or click blank then click option'
A'2'
B'Sheet2'
C2
DSheet2
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around the sheet number.
Using the sheet name without quotes or with wrong quotes.
4fill in blank
hard

Fill both blanks to read only the first 5 rows and skip the first row of an Excel sheet.

R Programming
df <- read_excel('data.xlsx', n_max = [1], skip = [2])
Drag options to blanks, or click blank then click option'
A5
B1
C10
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing the values for n_max and skip.
Using zero for skip when the first row should be skipped.
5fill in blank
hard

Fill all three blanks to read an Excel file, select the sheet named 'Data', and convert column names to lowercase.

R Programming
df <- read_excel('data.xlsx', sheet = [1])
names(df) <- tolower([2])
print(head([3]))
Drag options to blanks, or click blank then click option'
A'Data'
Bnames(df)
Cdf
D'Sheet1'
Attempts:
3 left
💡 Hint
Common Mistakes
Using sheet index instead of sheet name.
Not using quotes around sheet name.
Trying to convert names of a wrong object.