On 21-Sep-07 17:15:08, D. R. Evans wrote: > This is a real newbie question. What makes it worse is that I know > I've seen the answer somewhere, but I can no longer find it. > > If I have a loop that is supposed to generate a vector piecemeal, > adding an element each time through the loop, what do I do to stop it > failing the first time around the loop, when the vector doesn't yet > exist (so I can't use the append() function)?
I always use NULL, as in: x<-NULL for(...){ ... ; x<-c(x,...)} It has not let me down yet! Best wishes, Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <[EMAIL PROTECTED]> Fax-to-email: +44 (0)870 094 0861 Date: 21-Sep-07 Time: 22:33:26 ------------------------------ XFMail ------------------------------ ______________________________________________ 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.