?diff and look at argument 'lag'.
On 2010-05-12 13:06, Clark Johnston wrote:
I was looking for a function which would take the difference along a vector?
a<-c(1,12,23,44,15,28,7,8,9,10)
if I set the number difference to 3 would return
43
2
5
-37
-7
-19
3
or do I need to write my own function for this.
--
Peter Ehlers
University of Calgary
______________________________________________
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.