Select first element of nested list
Another possibility uses the nice purrr
library:
library(purrr)
map(x, 1)
Not much of a shortcut, but you can do this:
lapply(x, `[[`, 1)
# [[1]]
# [1] 1
#
# [[2]]
# [1] 3
#
# [[3]]
# [1] 5
Another possibility uses the nice purrr
library:
library(purrr)
map(x, 1)
Not much of a shortcut, but you can do this:
lapply(x, `[[`, 1)
# [[1]]
# [1] 1
#
# [[2]]
# [1] 3
#
# [[3]]
# [1] 5