[R] find variation of a binary matrix

email email8889 at gmail.com
Mon Nov 18 22:23:16 CET 2013


Hi:

I want to calculate how much the values in a binary matrix varies, and
for that I apply the sd() method.


mat <- matrix(c(1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1), nrow=4, ncol=3)
stddev <- sd(dist(mat,  method="binary"))

And i get the following answer:

stddev
[1] 0.3442652

Is this correct? Or there is a better way out?

Bests:

John



More information about the R-help mailing list