В Fri, 16 Aug 2024 10:35:35 +0200 <sibylle.stoec...@gmx.ch> пишет:
> what do you mean by use is.na() in getValues(). So I need to call > getValues a second time? Not necessarily, but it's one of the options. I was thinking along the lines of: values1 <- getValues(r1) mask1 <- is.na(values1) # Do the same for r2 # Combine the masks all.equal(values1[!combined_mask], values2[!combined_mask]) Unlike compareRaster(), this assumes that the coordinate grid of r1 and r2 is already the same and that only some of the values may differ. > I suppose you mean to first prepare a mask using is.na without > getValues and then in the second step your code? 'raster' documentation says that is.na() works on raster objects, so it should work. Even if it didn't work, since you already access the underlying data using getValues() and then compare the resulting vectors using all.equal(), using is.na(getValues(...)) should definitely work. -- Best regards, Ivan ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.