Hi,

  Just learned another way to calculate sd for a frequency distribution
matrix:

> p <- matrix(c(10,3,20,4,30,5),ncol=2,byrow=TRUE)
> p
     [,1] [,2]
[1,]   10    3
[2,]   20    4
[3,]   30    5
> rep(p[,1],p[,2])
 [1] 10 10 10 20 20 20 20 30 30 30 30 30
> sd(rep(p[,1],p[,2]))
[1] 8.348471



--
View this message in context: 
http://r.789695.n4.nabble.com/sd-mean-with-a-frequency-distribution-matrix-tp4703218p4703441.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to