[R] vector math: calculating a rolling 12 row product?

r user ruser2006 at yahoo.com
Tue Feb 28 16:27:23 CET 2006


I have a dataframe of numeric values with 30 “rows”
and 7 “columns”.

For each column, beginning at “row” 12 and down to
“row” 30, I wish to calculate the “rolling 12 row
product”.  I.e., within each column, I wish to
multiply all the values in row 1:12, 2:13,
19:30.

I wish to save the results as a new dataframe, which
will have 19 rows and 7 columns.




More information about the R-help mailing list