Skip to content
Back to formatted view

Raw Message

Message-ID: <4E3C14A9.8000801@gmail.com>
Date: 2011-08-05T16:04:57Z
From: Duncan Murdoch
Subject: question
In-Reply-To: <188AD193-07E4-4619-981B-7AEA8CCE8590@yahoo.es>

On 05/08/2011 10:46 AM, Angel Valverde Portal wrote:
> Hi everybody,
>
> How can I transform a 0/1 matrix into a TRUE/FALSE matrix, and vice versa?

If A is your matrix, and you really want 0 to be TRUE (a little 
weird...), just use

A == 0

and you get a logical matrix. To go the other way, as.numeric will 
convert TRUE to 1 and FALSE to 0; if you don't want that, pre- or 
post-process.

Duncan Murdoch