I am trying to find the rolling mean since the beginning of the data:
samp <- structure(list(samp = c(0.25, 0.4868, 0.6043, 0.5184, -0.3572, 0.4685, 0.8264,
You could use cummean from dplyr.
cummean
dplyr
cummean(samp$samp)
How about cumsum(samp$samp)/1:nrow(samp)
cumsum(samp$samp)/1:nrow(samp)