i've written a function to coerce a matrix (e.g. from numeric to logical), but i'd like to know if someone has a more elegant method for this:
> m <- matrix(c(0, 1, 1, 0), ncol = 2) > m <- as.logical(m) > m [1] FALSE TRUE TRUE FALSE i'd like 'm' to still be a matrix with the original dimensions. in my function to do this, i coerce 'm' to a logical, then re-form it as a matrix, which seems like an extra (possibly bug-introducing) step that might be avoided if i knew of some "hidden" feature that might permit this in one fell swoop. any ideas? ______________________________________________ R-help@r-project.org 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.