Create a named list with three elements: a vector, a matrix, and a data frame. Access one element by its name.
EasyProblem Statement
Create a named list with three elements: a vector, a matrix, and a data frame. Access one element by its name.
Sample Input
None
Sample Output
$vector [1] 1 2 3 Accessed element: [1] 1 2 3
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
# Predefined structure
named_list <- list(vector = c(1, 2, 3), matrix = matrix(1:4, nrow = 2), data_frame = data.frame(Name = c("Alice", "Bob"), Age = c(25, 30)))
print(named_list$vector)
Input
None
Expected Output
$vector [1] 1 2 3 Accessed element: [1] 1 2 3