Re: [R] 3-day moving average for block maxima

2017-07-22 Thread Jeff Newmiller
Thank you for the dput, but you roll the dice each time you fail to learn how to post using plain text that we may not find your email readable or even intact. Please learn to post plain text email on this mailing list. # The following assumes you have no missing days in your time sequence. # T

[R] 3-day moving average for block maxima

2017-07-21 Thread roslinazairimah zakaria
Dear r-users, I would like to construct 3-day moving average for block maxima series. I tried this: bmthree <- lapply(split(dt, dt$Year), function(x) max(sapply(1:(nrow(x)-2), function(i) with(x, mean(Amount[i:(i+2)],na.rm=TRUE) bmthree and got the following output. $`1