menu

Data Types and Variables in R


1. Which of the following functions is used to remove missing values from a vector in R?

na.omit()

complete.cases()

is.na()

drop_na()


2. Which of the following functions is used to sort a vector in ascending order in R?

sort()

order()

rank()

aggregate()


3. Which of the following data types is used to represent positive infinity in R?

NA

NaN

Inf

#NAME?


4. Which of the following is a valid way to create a vector in R?

vec <- 1 2 3

vec <- c(1, 2, 3)

vec <- c(1 2 3)

vec <- [1, 2, 3]


5. Which of the following data types can store both numeric and character data?

Vector

List

Data frame

Matrix


6. Which of the following data types is used to represent not-a-number values in R?

NA

NaN

Inf

#NAME?


7. Which of the following data types is used to represent a two-dimensional table in R?

Vector

List

Data frame

Matrix


8. Which of the following functions is used to convert a character variable to a numeric variable in R?

as.numeric()

as.character()

as.logical()

as.factor()


9. What is the maximum length of a vector in R?

2^31-1

2^32-1

2^63-1

There is no maximum length


10. Which of the following is not a basic data type in R?

Integer

Character

Logical

Matrix