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 0 4 4 4 4 4 4 4 0 0 4 4 4 4 4 4 0 0 0 4 4 4 4 4 0 0 0 0 4 4 4 4 0 0 0 0 0 5 5 5 0 0 0 0 0 0 5 5 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 > a-b (expected) 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 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 0 0 0 0 0 0 0 ______________________________________________ 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.