Thanks a lot for the help
________________________________ From: Jeff Newmiller <jdnew...@dcn.davis.ca.us> Sent: Sunday, October 9, 2011 6:35 PM Subject: Re: [R] Substract "previous" element Vectors are not matrices in R, though matrices are special cases of vectors. See ?diff for a solution that works with vectors. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnew...@dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. Dear all, >I have a matrix with data and I want to substract from every value the >previous element. > >Let's assume that my vector(matrix) is c<-(1,2,3,4,5) >I want to get remove_previous c<-(0,1,2,3,4). > >How I can do that efficiently in R? > >I would like to thank you in advance for your help >B.R >Alex > >[[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. > [[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.