An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20111009/90f25584/attachment.pl>
Substract "previous" element
4 messages · michael.weylandt at gmail.com (R. Michael Weylandt, Jeff Newmiller, Alaios
Take a look at diff() though offhand I dont know what it does to matrices M
On Oct 9, 2011, at 11:00 AM, Alaios <alaios at yahoo.com> wrote:
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 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.
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20111009/622b19e3/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20111009/93cc9b04/attachment.pl>