Many thanks Ivan
Use is.na() on getValues() outputs, combine the two masks using the | operator
to get a mask of values that are missing in either raster, then negate the mask
to choose the non-missing values:
all.equal(getValues(r1)[!mask], getValues(r2)[!mask])
--> what do you mean by use is.na() in getValues(). So I need to call
getValues a second time? I suppose you mean to first prepare a mask using is.na
without getValues and then in the second step your code?
Kind regards
Sibylle
-----Original Message-----
From: Ivan Krylov <ikrylov at disroot.org>
Sent: Friday, August 16, 2024 9:28 AM
To: SIBYLLE ST?CKLI via R-help <r-help at r-project.org>
Cc: sibylle.stoeckli at gmx.ch
Subject: Re: [R] allequal diff
? Fri, 16 Aug 2024 07:19:38 +0200
SIBYLLE ST?CKLI via R-help <r-help at r-project.org> ?????:
> Is it possible to consider na.rm=TRUE?
> > all.equal(getValues(r1), getValues(r2_resampled), tolerance = 0)
>
> [1] "'is.NA' value mismatch: 9544032 in current 66532795 in
target"
Use is.na() on getValues() outputs, combine the two masks using the | operator
to get a mask of values that are missing in either raster, then negate the mask
to choose the non-missing values:
all.equal(getValues(r1)[!mask], getValues(r2)[!mask])
--
Best regards,
Ivan