[R] how to bind lists recursively

Daniel Yang r90227019 at ntu.edu.tw
Wed May 28 04:43:59 CEST 2008


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



More information about the R-help mailing list