I am pretty new to R and wanted to calculate the cumulative standard deviation by group in R. I have a data frame D which has an ID for visitor and the corresponding time on
You can do it with base functions:
cumsd <- function(x) sapply(sapply(seq_along(x), head, x=x), sd) df1$cum_sd <- ave(df1$top, df1$ID, FUN=cumsd)