Create a list containing a vector, a matrix, and a data frame.
EasyProblem Statement
Create a list containing a vector, a matrix, and a data frame.
Sample Input
None
Sample Output
$vector
[1] 1 2 3
$matrix
[,1] [,2]
[1,] 1 3
[2,] 2 4
$data_frame
Name Age
1 Alice 25
2 Bob 30
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
# Predefined structure
list_object <- list(vector = c(1, 2, 3), matrix = matrix(c(1, 2, 3, 4), nrow = 2), data_frame = data.frame(Name = c("Alice", "Bob"), Age = c(25, 30)))
print(list_object)
Input
None
Expected Output
$vector
[1] 1 2 3
$matrix
[,1] [,2]
[1,] 1 3
[2,] 2 4
$data_frame
Name Age
1 Alice 25
2 Bob 30