Skip to content
Back to formatted view

Raw Message

Message-ID: <1294651046014-3206797.post@n4.nabble.com>
Date: 2011-01-10T09:17:26Z
From: emj83
Subject: Changing a logical matrix into a numeric matrix

Hi,

I would like to turn my TRUE/FALSE matrix into a 1/0 matrix (i.e. True=1 and
False=0)

      [,1]  [,2]  [,3]  
[1,]  TRUE FALSE FALSE 
[2,]  TRUE  TRUE FALSE 
[3,]  TRUE  TRUE  TRUE 

      [,1]  [,2]  [,3]  
[1,]    1    0     0
[2,]    1    1     0
[3,]    1    1     1

Is there a quick way of doing this without a loop?

Thanks Emma
-- 
View this message in context: http://r.789695.n4.nabble.com/Changing-a-logical-matrix-into-a-numeric-matrix-tp3206797p3206797.html
Sent from the R help mailing list archive at Nabble.com.