What will be the output of the following R code?
> y <- data.frame(a = 1, b = "a")
> dput(y)
> y <- data.frame(a = 1, b = "a")
> dput(y)A.
structure(list(a = 1, b = list(1L, .Label = "a", class = "factor")), .Names\
= c("a",
"b"), row.names = c(NA, -1L), class = "data.frame")B.
list(list(a = 1, b = list(1L, .Label = "a", class = "factor")), .Names\
= c("a",
"b"), row.names = c(NA, -1L), class = "data.frame")C.
structure(list(a = 1, b = structure(1L, .Label = "a", class = "factor")), .Names\
= c("a",
"b"), row.names = c(NA, -1L), class = "data.frame")D. Error
Answer: Option C
Related Questions on Data Structures in R Programming
Which data structure in R is used to store an ordered collection of elements?
A. List
B. Matrix
C. Data Frame
D. Vector
What does the matrix() function create in R?
A. A list of elements
B. A one-dimensional array
C. A two-dimensional array
D. A data frame
In R, how do you create a list named my_list with three elements: 1, "hello", and TRUE?
A. my_list <- c(1, "hello", TRUE)
B. my_list = list(1, "hello", TRUE)
C. my_list(1, "hello", TRUE)
D. list(my_list = c(1, "hello", TRUE))
What is the primary data structure used for storing tabular data in R?
A. List
B. Matrix
C. Data Frame
D. Array

Join The Discussion