Cumulative standard deviation: Difference between revisions
m
→{{header|R}}
m (→{{header|R}}) |
m (→{{header|R}}) |
||
Line 3,574:
If the goal is to get a vector of running standard deviations, the simplest is to do it with cumsum:
<lang
n <- seq_along(x)
sqrt(cumsum(x^2) / n - (cumsum(x) / n)^2)
Line 3,592:
The task requires an accumulator solution:
<lang
n <- 0
m <- 0
|