[R] Appending to list

Mike Prager Mike.Prager at noaa.gov
Wed Feb 9 22:03:48 CET 2005


An R program needs to accumulate a list (length unknown until done) of 
objects.  How efficiently and repeatedly can one append new objects to the 
list?

I have been using something like

mylist[[length(mylist)+1]] = newobject

but I wonder if there is something better.



-- 
Michael Prager
NOAA Center for Coastal Fisheries and Habitat Research
Beaufort, North Carolina  28516  USA
http://shrimp.ccfhrb.noaa.gov/~mprager/

NOTE: Opinions expressed are personal, not official. No government
endorsement of any product is made or implied.




More information about the R-help mailing list