[R] Initializing lists with n objects (never mind)
Sam Field
fieldsh at mail.med.upenn.edu
Fri May 11 17:54:45 CEST 2007
sorry every one. I figured it out. I didn't realize that you could add
objects so easily. I just went with
example.list <- list(1)
Sam
Sam Field wrote:
> Hopefully quick question. I would like to populate a list with n
> objects using a for loop, so within the loop (i to n) I need to refer
> to a list as example.list[[i]] . This requires that I create a
> example.list[[i]] with n objects before the for loop. How do I do
> this? With matrices it is easy (matrix()).
>
> thanks!
>
> Sam
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>
>
>
More information about the R-help
mailing list