[R] Selecting first 7 elements

Erik Iverson eriki at ccbr.umn.edu
Sun May 23 09:10:03 CEST 2010


> "[" is a function, and you want to use it on each element of the list, 
> so...
> 
> lapply(x, "[", c(1:7))

and the call to c() is of course not necessary, since ":" will generate a vector.



More information about the R-help mailing list