Dear all,

Suppose that I have a matrix A

   A <- matrix(c(3,3,3,3,3,3,3,3,3),3,3)

and a logical matrix B

   B <- matrix(c(T,T,T,F,T,T,F,T,F),3,3)

The result  matrix should be

   C <- matrix(c(3,3,3,NA,3,3,NA,3,NA),3,3)

Is there any simple tip or trick to perform this without looping?

Thanks in advance for any suggestion.

Best regards, Andrej

______________________________________________
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.

Reply via email to