[R] Initializing lists with n objects

Sam Field fieldsh at mail.med.upenn.edu
Fri May 11 17:43:08 CEST 2007


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



More information about the R-help mailing list