'[[' and recursiveness

  • '[[' can be used to select a single element, removing the names attribute.
  • For lists, '[[' does not return a list but an object of the class of the underlying list element
x <- list(a = c(1,2,3),
          b = c(4, 5, 6))
data.class(x[1])
## [1] "list"
# vs.
data.class(x[[1]])
## [1] "numeric"