Hello;
I'll put my real problem through a simple example:
I've got a main list:

> main.lst <- lst()

With a number of sublists:

> for(i in 1:1000){
   main.lst[[i]] <- list()
   main.lst[[i]]$first  <- runif(1,0,1)
   main.lst[[i]]$second <- runif(2,3,4)
  }

If later on I need to split this list, how could I extract several
sublists in a vectorized form? For example, to extract the four first
sublists, to be passed to a function, sintaxis like this won't work:

> sublist <- main.lst[[1:4]]

Although I could do

> sublist <- list()
> for(i in 1:4){ sublist[[i]] <- main.lst[[i]] }

I would hope that a vectorized way could exist.

Thanks, and regards,
Javier
-------

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to