[R] extraction of vector elements to new list

Gabor Grothendieck ggrothendieck at gmail.com
Mon Jul 23 17:11:24 CEST 2007


On 7/23/07, Dimitris Rizopoulos <dimitris.rizopoulos at med.kuleuven.be> wrote:
> try this:
>
> new.list <- lapply(my.list, "[", i = 1:2)
> new.list

You could use the lapply above or

   lapply(my.list, head, 2)



More information about the R-help mailing list