Skip to content
Prev 326303 / 398502 Next

change cell values

Hello,

It's not working because you are changing mat1 before the second 
condition is evaluated, and so mat1 is full of NA values. Try the following.



tmp <- mat1  # Make a copy
tmp[mat1 < 1 & mat2 < 1] <- NA  # And change that copy
mat2[mat1 < 1 & mat2 < 1] <- NA
mat1 <- tmp
rm(tmp)


Hope this helps,

Rui Barradas

Em 03-07-2013 22:27, JiangZhengyu escreveu: