Skip to content
Prev 30416 / 398513 Next

Transforming matrix

At 15:56 10/04/2003 +0200, vous avez ?crit:
I guess you mean:

  TRUE ==> 1
FALSE ==> 0

as this is the rule when logicals are converted into numerics. Then, if M 
is your matrix, you can do:

mode(M) <- "numeric"

If you actually want:

  TRUE ==> 0
FALSE ==> 1

then:

M <- !M
mode(M) <- "numeric"

should do it.

HTH

EP