Transforming matrix
On Thu, 10 Apr 2003, Ramon Diaz wrote:
If you have your TRUE/FALSE values in m1, then do
mode(m1) <- "numeric".
This is probably not the best way but it seems to work.
That maps TRUE to 1 and FALSE to 0, and I read the request as for the reverse. ifelse(m1, 0, 1) is probably the most transparent way.
On Thursday 10 April 2003 15:56, Ramzi Feghali wrote:
hi everybody, anyone knows how we can transform a binary matrix with TRUE and FALSE to 0 and 1 without looping? Thx
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595