Skip to content
Prev 266062 / 398502 Next

transforming a matrix of logical to 0 and 1 while keeping the dim of matrix

Hi,

I am not sure about "correct", but R stores logical values TRUE/FALSE
as 1/0 already so simply changing the mode would suffice:

mode(x) <- "numeric"

alternately

x + 0

HTH,

Josh
On Wed, Jul 20, 2011 at 8:16 AM, Julian TszKin Chan <cjulian at bu.edu> wrote: