[R] list of lists

Uwe Ligges ligges at statistik.uni-dortmund.de
Mon Jun 17 17:34:18 CEST 2002


Juan Ramon Gonzalez 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)?
 
 lapply(times, function(x) x$time)
or 
 unlist(lapply(times, function(x) x$time))
to get only one vector

Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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