Vidyalelo
R Programming · all questions

Data Structures in R Programming
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

122

Questions

1/7

Page

Pick an option on a question to see the right answer and solution.

Which data structure in R is used to store an ordered collection of elements?

Select an option to see the answer and solution.

What does the matrix() function create in R?

Select an option to see the answer and solution.

In R, how do you create a list named my_list with three elements: 1, "hello", and TRUE?

Select an option to see the answer and solution.

What is the primary data structure used for storing tabular data in R?

Select an option to see the answer and solution.

How is a vector different from a list in R?

Select an option to see the answer and solution.

In R, how is a matrix initialized with values 1 to 9 arranged in three rows?

Select an option to see the answer and solution.

How do you create a factor in R named color with levels "red", "green", and "blue"?

Select an option to see the answer and solution.

What is the purpose of the data.frame() function in R?

Select an option to see the answer and solution.

In R, how do you create a named list with elements "apple", "orange", and "banana"?

Select an option to see the answer and solution.

What is the correct way to access the second element of a vector named my_vector in R?

Select an option to see the answer and solution.

How do you check the structure of a data frame named my_data in R?

Select an option to see the answer and solution.

In R, what is the purpose of the names() function?

Select an option to see the answer and solution.

What function is used to convert a factor to a character vector in R?

Select an option to see the answer and solution.

How is a data frame column named Age selected in R?

Select an option to see the answer and solution.

In R, how do you add a new column named Height to a data frame named my_data?

Select an option to see the answer and solution.

How do you create a character vector with the elements "apple", "orange", and "banana" in R?

Select an option to see the answer and solution.

What does the str() function do in R?

Select an option to see the answer and solution.

In R, how do you create a data frame named my_df with columns Name and Age?

Select an option to see the answer and solution.

What is the result of length(unique(c(1, 2, 3, 1, 2))) in R?

Select an option to see the answer and solution.

In R, how is a factor converted to a numeric vector using the as.numeric() function?

Select an option to see the answer and solution.