Hello, I am trying to calculate a 31 day running mean in some temperature data along ROWS. Rollmean() works great along columns, but how do I perform this same action on my rows? The data is a matrix of 365 columns (days of the year) by 5,000 rows (lat/long coordinates). I would like to perform a 31 day running mean along the 365 days. I am new to R so any help would be greatly appreciated! Thanks alot, Rheannon -- View this message in context: http://www.nabble.com/rollmean%28%29-tp18366044p18366044.html Sent from the R help mailing list archive at Nabble.com.
See ?t On Wed, Jul 9, 2008 at 12:50 PM, Rheannon <rbrooks at uvic.ca> wrote:> > Hello, > > I am trying to calculate a 31 day running mean in some temperature data > along ROWS. Rollmean() works great along columns, but how do I perform this > same action on my rows? > > The data is a matrix of 365 columns (days of the year) by 5,000 rows > (lat/long coordinates). > I would like to perform a 31 day running mean along the 365 days. > > I am new to R so any help would be greatly appreciated! > > Thanks alot, > Rheannon > -- > View this message in context: http://www.nabble.com/rollmean%28%29-tp18366044p18366044.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. >
I am going to assume your data.frame is called x #this transposes the matrix x.t <- t(x) rollmean(x.t) On Wed, Jul 9, 2008 at 12:50 PM, Rheannon <rbrooks@uvic.ca> wrote:> > Hello, > > I am trying to calculate a 31 day running mean in some temperature data > along ROWS. Rollmean() works great along columns, but how do I perform this > same action on my rows? > > The data is a matrix of 365 columns (days of the year) by 5,000 rows > (lat/long coordinates). > I would like to perform a 31 day running mean along the 365 days. > > I am new to R so any help would be greatly appreciated! > > Thanks alot, > Rheannon > -- > View this message in context: > http://www.nabble.com/rollmean%28%29-tp18366044p18366044.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. >-- Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis [[alternative HTML version deleted]]