[R] shifting data in matrix by n rows

rcoder michael.larsson at gmail.com
Thu Jul 10 21:12:46 CEST 2008


Hi everyone,

Thanks very much for all your replies.

I'm interested in hearing more about the lag function. I remember coming
across this in the R intro manual, but I couldn't figure out how to apply it
to my case. Does anyone know how it is applied, assuming a time series data
frame?

Thanks,

rcoder



Gabor Grothendieck wrote:
> 
> If its a zoo or ts time series you can use the lag function.
> 
> On Wed, Jul 9, 2008 at 2:57 PM, rcoder <michael.larsson at gmail.com> wrote:
>>
>> Hi everyone,
>>
>> I have some data in a matrix, and I want to shift it down by one row. The
>> matrix in question has a date column. Does anyone know of a way to shift
>> the
>> data by one row, whilst preserving the date column in the matrix - i.e.
>> shift the data and leave the date column in the current location?
>>
>> Thanks,
>>
>> rcoder
>> --
>> View this message in context:
>> http://www.nabble.com/shifting-data-in-matrix-by-n-rows-tp18368420p18368420.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> 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.
>>
> 
> ______________________________________________
> 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.
> 
> 

-- 
View this message in context: http://www.nabble.com/shifting-data-in-matrix-by-n-rows-tp18368420p18389841.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list