I have a numeric vector in R containing a large set of value (ex. 0.05, 0.06, 0.09 etc.). I would like to perform a mathematical operation by sequential +1 moving alongside the vector. For example, I want a mean of 5 points (from 1-5), then move one position and get the mean (positions 2-6) and repeat (positions 3-7, 4-8 and so on). Store the values in a vector and eventually plot.
Asked
Active
Viewed 27 times
0
-
1You are describing a "rolling mean". If you search for that term, you are likely to find many useful answers. – MrFlick Apr 10 '17 at 15:17
-
Thank you, I didn't really know what to search exactly. However, I'm not interested in a mean per se, but I guess the principle will be the same. Should I delete my question since it's a duplicate? – ThePresident Apr 10 '17 at 15:41