[R] how to bind lists recursively

From: Daniel Yang <r90227019_at_ntu.edu.tw>
Date: Tue, 27 May 2008 21:43:59 -0500


Dear all,

I want to create a list that contains 0,1,2,3, ..., 10000 as its elements. I used the following code, which apparently doesn't work very well.

a <- 0
for(i in 1:10000) {

    a <- list(a, i)
}

The result is not what I wanted. So how to create the bind lists recursively so that the last element would be the newly added one while the previous elements all remain the same?

Thanks!
Daniel



R-help_at_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. Received on Wed 28 May 2008 - 05:04:02 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 28 May 2008 - 06:30:40 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive