Creating a list containing a matrix of size 2 by 5, and a vector of length 5, and a string:
mylist <- list(matrix(letters[1:10], nrow = 2, ncol = 5),
c("Brady, Rodgers, Romo, Newton, Wilson"),
"The Chicago Cubs won the 2016 World Series")
mylist
## [[1]]
## [,1] [,2] [,3] [,4] [,5]
## [1,] "a" "c" "e" "g" "i"
## [2,] "b" "d" "f" "h" "j"
##
## [[2]]
## [1] "Brady, Rodgers, Romo, Newton, Wilson"
##
## [[3]]
## [1] "The Chicago Cubs won the 2016 World Series"
Note that unlike data frames, list can contain elements of varying sizes and structures.
Use indexing to select the second list element:
mylist[[3]] # Selections third argument in mylist
## [1] "The Chicago Cubs won the 2016 World Series"