[R] list of lists

Emmanuel Paradis paradis at isem.univ-montp2.fr
Mon Jun 17 19:06:19 CEST 2002


At 17:01 17/06/02 +0200, you wrote:
>Hi R-users
>
>I have a list with 19 elments. This elements are a new list of 2 elements,
>for example:
>
>times<-
>[[1]]
>[[1]]$time
> 11  10
>147 206  30
>
>[[1]]$n
>[1] 3
>
>.......
>
>[[19]]
>[[19]]$time
> 96  96  96  94  98
> 78  78  78 147 100   4
>
>[[19]]$n
>[1] 6
>
>Does anyone know how obtain a vector with the elements $time as quick as
>possible (no loops)?

Giving your example, this should work:

unlist(lapply(times, "[[", 1))

EP

>Thank you
>
>
>Juan
>
>
>
>
>
>-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
.-.-
>r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
>Send "info", "help", or "[un]subscribe"
>(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
>_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
._._
>
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list