NEW
Font size
WorksheetsR programming
Total questions: 10
Worksheet time: 5mins
Which of the following is a valid way to create a vector in R?
vec <- [1,2,3,4]
vec <- c(1,2,3,4)
vec = (1,2,3,4)
vector <- {1,2,3,4}
What will length(c(10, 20, 30, 40)) return?
3
4
40
10 20 30 40
Which function in R is used to read a CSV file?
read.table()
read.csv()
import.csv()
load.csv()
What is the result of sum(1:5)?
10
15
5
1 2 3 4 5
Which of the following is NOT a data type in R?
Numeric
Character
Boolean
String
What does str() function do in R?
Displays the structure of an object
Converts a number to string
Creates a new string
Reads CSV files
Which of the following can store elements of different data types in R?
Vector
Matrix
List
Factor
What is the output of 1:5 * 2 in R?
2 4 6 8 10
1 2 3 4 5 2
Error
1 4 9 16 25
What will is.data.frame(airquality) return if airquality is a built-in dataset?
TRUE
FALSE
Depends on the version of R
NULL
Which function generates random numbers from a normal distribution?
runif()
rnorm()
sample()
rand()
