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
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.