Use result <- vector("list", n) to make a list of length n, all of whose components are NULL.
Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -----Original Message----- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Peter Langfelder > Sent: Monday, June 21, 2010 4:23 PM > To: song song > Cc: r-help@r-project.org > Subject: Re: [R] how to initial a list to store data result? > > On Mon, Jun 21, 2010 at 4:18 PM, song song > <rprojecth...@gmail.com> wrote: > > May I ask how to initialize a list? > > > > usually I will use " result=list(0) " to do this. is this right? > > It works, but it is cleaner to use > > results=list() > > The difference is that list(0) will have one component that contains > the number zero, whereas list() will simply initialize an empty list > (no components). > > Peter > > ______________________________________________ > 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. > ______________________________________________ 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.