[R] serial subtraction within a vector

Rui Barradas ruipbarradas at sapo.pt
Mon Sep 24 14:20:35 CEST 2012


Hello,

Try diff(v)

Hope this helps,

Rui Barradas
Em 24-09-2012 12:00, Hermann Norpois escreveu:
> Hello,
>
> I have a vector (numeric) v-> c(a,b,c,d,e) and I want to create the vector
> n->c(b-a,c-b,d-c,e-d). How can I do that?
>
>
> Thank you
> Hermann
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.




More information about the R-help mailing list