Skip to content
Prev 69823 / 398525 Next

how to use list index to get vector

I have a simple question, but I couldn't find the answer in R manuals.

Assume I have a list:
[[1]]
[1] 1 2 3

[[2]]
[1] 11 22 33

[[3]]
[1] 111 222 333

How to use list index to get a vector of, say, the first elements of
list elements?
That is, how to get a vector c(1, 11, 111) from foo?

foo[[]][1] doesn't work.

-Luke