[R] how to not sort factors when plotting

Lydia N. Slobodian lns at cantab.net
Mon May 12 15:52:15 CEST 2008


Hello.  I'm trying find the ratios between each of the integers in a
vector.  I have:

for (n in x) {
   ratio <- (x[n]/x[n-1])
   ratio.all <- c(ratio.all, ratio)
}

Of course this doesn't work, nor does diff(n)/diff(n-1).  Is there a
way to specify a pair of integers in a vector?

Thank you,

Lydia



More information about the R-help mailing list