[R] calcualtign a trailing 12 column mean in a dataframe?

r user ruser2006 at yahoo.com
Wed Mar 29 23:52:52 CEST 2006

I have a dataframe of 25 columns and 100,000 rows
called “testdf”.

I wish to build a new dataframe, with 14 columns and
100,000 rows.

I wish the new dataframe to have the “trailing 12
column” mean.  That is, I want column 1 of the new
dataframe to have soemthing like:

“( mean(testdf[,1:12],na.rm=T)”

What is the best way to accomplish this?

More information about the R-help mailing list