I'm new to R and trying to understand a few things about lists. Say I have the following:
n = c(2, 3, 5)
s = c("aa", "bb", "cc", "dd", "ee")
b = c(TRUE, FALSE, TRUE, FALSE, FALSE)
x = list(n, s, b, 3)
I understand the following (I think) because I'm asking R to return the second list of values (because I'm using single brackets).
x[2]
# [[1]]
# [1] "aa" "bb" "cc" "dd" "ee"
This I don't understand because I'm using double brackets which is supposed to return a single value. Actually, I'm not what I would expect R should return here. I'm asking for a single value but the second group of objects is another list.
x[[2]]
# [1] "aa" "bb" "cc" "dd" "ee"