- You have some structured blob of data and you want to perform some operations by dimensions.
- e.g. calculate row-wise means or column-wise means
m <- matrix(data=cbind(rnorm(30, 0), rnorm(30, 2), rnorm(30, 5)), nrow=30, ncol=3) dim(m)
## [1] 30 3
apply(m, 2, mean)
## [1] -0.1911862 2.3207591 4.7229545