Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to load a CSV file into R.
R Programming
data <- read.csv([1]) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the filename
Using incorrect function names
✗ Incorrect
To load a CSV file, you must provide the filename as a string in quotes.
2fill in blank
mediumComplete the code to check the first few rows of the loaded data.
R Programming
head([1]) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the filename instead of the data variable
Using function names instead of variables
✗ Incorrect
The head() function shows the first rows of the data frame named data.
3fill in blank
hardFix the error in the code to load a CSV file with headers.
R Programming
data <- read.csv("data.csv", [1] = TRUE)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using plural 'headers'
Using incorrect argument names
✗ Incorrect
The correct argument to specify headers in read.csv is header.
4fill in blank
hardFill both blanks to load a CSV file and view its structure.
R Programming
data <- [1]("data.csv", header = TRUE) str([2])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong function names
Using wrong variable names
✗ Incorrect
Use read.csv to load the file and str(data) to see its structure.
5fill in blank
hardFill all three blanks to load data, check its summary, and view the first rows.
R Programming
data <- [1]("data.csv", header = TRUE) summary([2]) head([3])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently
Using wrong function names
✗ Incorrect
Load data with read.csv, then use summary(data) and head(data) to explore it.