Hi, (1) You should provide a minimal working example;
(2) But anyway, does... x = sample(10) c(x[1],diff(x)) ... do what you want? Olivier. On Fri, 4 Mar 2016 13:22:07 +0200 catalin roibu <catalinro...@gmail.com> wrote: > Dear all! > > I want to calculate difference between successive values (cumulative > values) with R. I used diff function, but I want to keep the first > values. > > Please help me to solve this problem! > > Thank you! > > Best regards! > > CR > > -- > > - > - > Catalin-Constantin ROIBU > > Lecturer PhD, Forestry engineer > Forestry Faculty of Suceava > Str. Universitatii no. 13, Suceava, 720229, Romania > office phone +4 0230 52 29 78, ext. 531 > mobile phone +4 0745 53 18 01 > FAX: +4 0230 52 16 64 > silvic.usv.ro <http://www.usv.ro/> > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. -- Olivier Crouzet, PhD Laboratoire de Linguistique de Nantes -- UMR6310 CNRS / Université de Nantes Chemin de la Censive du Tertre -- BP 81227 44312 Nantes cedex 3 France http://www.lling.univ-nantes.fr/ ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.