unlister {rube} | R Documentation |
A named list that contains an element named "unlist" is altered by applying unlist to elements listed in the "unlist" vector (possibly renaming them).
unlister(data)
data |
A named list (of data). |
If one of the elements of "data" is a string vector named "unlist", then the strings are ta
A new named vector with no "unlist" element and with designated elements unlisted.
Howard J. Seltman <hseltman@stat.cmu.edu>
http://www.stat.cmu.edu/~hseltman/rube
## This example returns a list of three vector elements: age, id, and female ## where age a vector matched to id. Note that "ages" is originally a ragged ## list, that its name is changed, and that the result does not have an "unlist" ## element. lens <- sample(5:7, 10, rep=TRUE) temp <- list(ages=lapply(lens, function(x) sample(20:70,x,rep=TRUE)), id=rep(1:10, each=lens), female=rbinom(10,1,0.5), unlist=list(age="ages")) unlister(temp)