R UseRs:

I can't figure out how to append intermediate terms inside a For loop.  My 
use of append(), various indexing, and use of data frames, vectors, 
matrices has been fruitless.  Here's a simplified example of what I'm 
talking about:

i <- 1
for(i in 10) {
    v[i] <- i/10
}
> v
 [1]  1 NA NA NA NA NA NA NA NA  1

I would like: [1] 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0

Any help on this would be greatly appreciated.

-Jason

PS:  I realize that I could have gone v <- 1:10, then v <- v / 10, as I 
said this is a simplified example; the actual function to be evaluated 
iteratively in the for loop is more complex than just "x /10"
        [[alternative HTML version deleted]]

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to