I have a script that is calculating cumulative average and standard deviation:
library(tidyverse)
tibble(aa = c(2, 3, 4, 5, 6, 7, 8)) %>%
mutate(
running_mean = sapply(seq(n()), function(i) mean(aa[seq(i)])),
running_sd = sapply(seq(n()), function(i) sd(aa[seq(i)])),
)
I would like now to randomize my observations 'aa' 100 times and calculate just one average of 100 runs.