Hi,
Would that work for you?
d <- a-b
d[a==0 | b==0] <- 0
The output is as the one expected
HTH,
Ivan
Le 11/24/2010 15:54, Romildo Martins a écrit :
Hello,
I would like to perform the operation a - b, only for the non-zero values.
Thanks a lot!
RMB
a
0 0 0 0 4 0 0 0
0 0 0 0
Hello,
I would like to perform the operation a - b, only for the non-zero values.
Thanks a lot!
RMB
> a
0 0 0 0 4 0 0 0
0 0 0 0 0 3 0 0
0 0 0 0 0 0 0 3
0 0 0 0 0 0 4 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
> b
2 matches
Mail list logo