-1

I want to calculate the standard deviation for x = [1:15], [1:1000]. I am looking for a way to get the standard deviation for every group of 15 - so 1000 standard deviations in total, but i cant find a formula for it.

  • [See here](https://stackoverflow.com/q/5963269/5325862) on making a reproducible example that is easier for folks to help with. That includes a sample of data and a clear explanation of what you've tried and what hasn't worked – camille Apr 06 '21 at 14:43

2 Answers2

1

Maybe you need apply over the margin 2, e.g.,

apply(x,2,sd)
ThomasIsCoding
  • 96,636
  • 9
  • 24
  • 81
0

If it is a matrix, another option is colSds from matrixStats

library(matrixStats)
colSds(x)

Or another option is dapply from collapse

library(collapse)
dapply(x, fsd)
akrun
  • 874,273
  • 37
  • 540
  • 662