[R] serial subtraction within a vector

PIKAL Petr petr.pikal at precheza.cz
Mon Sep 24 14:25:07 CEST 2012


Hi

I suppose you want

diff(v)

Regards
Petr



> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Hermann Norpois
> Sent: Monday, September 24, 2012 1:01 PM
> To: r-help at r-project.org
> Subject: [R] serial subtraction within a vector
> 
> 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