Timeline for Mean of a sliding window in R
Current License: CC BY-SA 2.5
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 6, 2010 at 17:51 | vote | accept | T-Burns | ||
Oct 6, 2010 at 15:59 | comment | added | T-Burns | Thanks! Especially for noting the last value as zero assumption, I hadn't considered that. I definitely care about that last window!! | |
Sep 25, 2010 at 9:24 | comment | added | user88 | @ucfagls Yet this is easy to change and as you said this assumption was made by the OP. On the other hand, I would be even more restrictive and removed the last average. | |
Sep 25, 2010 at 9:03 | history | edited | Gavin Simpson | CC BY-SA 2.5 |
added 482 characters in body
|
Sep 25, 2010 at 8:59 | comment | added | Gavin Simpson |
@mbq; that is making a strong assumption that the observation is 0. I had been mulling this point and T-Burns is making the same assumption (an unobserved 0). I would prefer perhaps to pad with NA and pass in the na.rm = TRUE argument to mean . The answer won't be the same as what the OP requested, but it seems more useful. I'll edit my answer to include this.
|
|
Sep 25, 2010 at 8:36 | comment | added | user88 |
You may add a 0 at the end of x (x<-c(x,0) ) to get the last element of answer.
|
|
Sep 24, 2010 at 22:11 | comment | added | Tal Galili | BTW, I once wrote about a usage of this function to implement the notion of "quantile loess" : r-statistics.com/2010/04/… | |
Sep 24, 2010 at 15:46 | history | edited | Gavin Simpson | CC BY-SA 2.5 |
typo
|
Sep 24, 2010 at 15:36 | history | answered | Gavin Simpson | CC BY-SA 2.5 |