[R] saving while loop values to one vector

Syed Abid Hussaini ohitsabid at yahoo.com
Mon Dec 24 01:48:47 CET 2007


Hi all,
  I am pretty new to R and even new to programming in general. Right now i get only one value for
j below (print(j)), how do i save all j values to one vector or matrix? Sorry for this very basic
question. thanks in advance.

wave2 <- abs(Re(rnorm(100)))
i <- findInterval((wave2[1]), wave2)
i <- i+1

while (i < length(wave2))  {
j <- (wave2 [i] - wave2[i-1])
print(j)
i<-i+1
}

abid



      ____________________________________________________________________________________
Looking for last minute shopping deals?



More information about the R-help mailing list