On Sun, Nov 28, 2010 at 7:58 PM, Peter Ehlers <ehl...@ucalgary.ca> wrote:
> Then, since this is R, here's the next step:
>
>  v <- sample(50, 100, replace = TRUE)
>  result <- diff(v) / v[-length(v)]

Very nice!  It did not even occur to me to use diff() in this case,
though that is exactly what is needed and I've used it a hundred times
in other situations (I hope I'm like wine and get better with age
or....)

Josh

>
> Peter Ehlers
>

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to