The general idea is to sweep the function across. You have many options, one is apply():
apply()
R> set.seed(42) R> M <- matrix(rnorm(40),ncol=4) R> apply(M, 2, sd) [1] 0.835449 1.630584 1.156058 1.115269 R>
2.1m questions
2.1m answers
60 comments
57.0k users