[R] How to get standard deviation of rows in a matrix
Sundar Dorai-Raj
sundar.dorai-raj at pdf.com
Wed Mar 9 21:00:40 CET 2005
Jagarlamudi, Choudary wrote on 3/9/2005 1:49 PM:
> Hi all,
>
> I am trying to find sd of my rows in a matrix and i get column sd inspite of extracting rows.
> I tried to do the sqrt(var(x)) but that did'nt work as well,
>
> Here is my data
>
> genes
> 15 24 63 40
> 25 42 46 35
> 23 53 37 45
> 30 37 50 55
> 40 51 30 48
>
> x<-sd(genes[1:5,])
>
> y<-sqrt(var(genes[1:5,]))
>
> I get 4 sds for the 4 columns instead of 5 sds for my 5 rows.
> Thanks you in advance.
>
This has come up several times in the past and a quick search of the
archives would have lead you to:
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/34169.html
HTH,
--sundar
More information about the R-help
mailing list