[R] List-manipulation

Richard M. Heiberger rmh at temple.edu
Fri Sep 29 19:00:38 CEST 2006


You need one of the apply family of functions.
?sapply

> tmp <- list(a=1:2, b=3:5, c=5, dd=numeric(0), e=1:8)
> sapply(tmp, function(x) x[1])
 a  b  c dd  e 
 1  3  5 NA  1



More information about the R-help mailing list