"Liaw, Andy" <[EMAIL PROTECTED]> writes: > Is this what you're looking for? > > > x <- numeric(0) > > for (i in 1:5) x <- append(x, i) > > x > [1] 1 2 3 4 5 > > Andy
Also notice that in R many things are vectorized, so you may prefer > append(x,1:5) [1] 1 2 3 4 5 Extending a vector is done by allocating a longer vector and copying the original. You really don't want to do that for every element if you at all can avoid it. So vectorize, or at least preallocate the extra storage, if you can. -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
