Introduction to lists

mylist <- list("a", TRUE, lubridate::today())
mylist
## [[1]]
## [1] "a"
## 
## [[2]]
## [1] TRUE
## 
## [[3]]
## [1] "2024-07-14"
str(mylist)
## List of 3
##  $ : chr "a"
##  $ : logi TRUE
##  $ : Date[1:1], format: "2024-07-14"
mylist[2:3] # list subsetting (shortens the list)
## [[1]]
## [1] TRUE
## 
## [[2]]
## [1] "2024-07-14"
mylist[[3]] # element extraction (one level deeper)
## [1] "2024-07-14"