Skip to content

How to get standard deviation of rows in a matrix

1 message · Liaw, Andy

#
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