[R] Fwd: for loop

2010-09-21 Thread Michael Bedward
First up, you've got a problem if your vectors are 520 elements in length because you accessing element i+1 in your loop and when i is 520 you won't have a valid value. Next, you don't really need a for loop at all :)  You can do those operations on the whole vectors... e.g. tmp1 <- (1 - samp.pct

[R] Fwd: 'for Loop'

2009-04-01 Thread Alan O'Loughlin
Hello, A nice guy call Jun Shen was helping me out with this, but I require a bit more help. Below is my data set or list called 'test'. I'm trying to calculate the %RSD for each pair of index and keep it in cronological order if you can imagine a 3rd column with 'date' beside index. Res