Skip to content
Prev 65650 / 398506 Next

How to get standard deviation of rows in a matrix

You should read ?var and ?sd more carefully.  For a data frame or a matrix,
var() returns the covariance matrix of the columns, whereas sd() returns the
standard deviations of the columns.  If you want standard deviations of the
rows, you need to transpose the data.

Andy