| unlist {base} | R Documentation |
Flatten Lists
Description
Given a list structure x, unlist
produces a vector which contains all the atomic components
which occur in x.
If recursive=FALSE, the function will not
recurse beyond the first level items in x.
By default, unlist tries to retain the naming
information present in x.
If use.names=FALSE all naming information is dropped.
Usage
unlist(x, recursive=TRUE, use.names=TRUE)
See Also
c, as.list.
Examples
unlist(options())
unlist(unlist(options(), use.names=F))# works for vectors or lists
l.ex <- list(a = list(1:5, LETTERS[1:5]), b = "Z", c = NA)
unlist(l.ex, rec = F)
unlist(l.ex, rec = T)