Skip to content
Prev 65652 / 398506 Next

How to get standard deviation of rows in a matrix

On Wed, 9 Mar 2005 13:49:44 -0600, "Jagarlamudi, Choudary"
<choudary.jagar at swosu.edu> wrote :
This doesn't extract the rows, it just returns the same matrix.  As
the man page for sd says, when applied to a matrix it calculates the
standard deviation of each column.

What you want to do is to use the apply function.  Rows are the first
dimension, so you would use

apply(genes, 1, sd)

Duncan Murdoch