Hi I suppose you want
diff(v) Regards Petr > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Hermann Norpois > Sent: Monday, September 24, 2012 1:01 PM > To: r-help@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@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. ______________________________________________ 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.