-
From: R-help On Behalf Of Bert Gunter
Sent: Sunday, August 18, 2024 11:21 PM
To: Ben Bolker
Cc: r-help@r-project.org
Subject: Re: [R] allequal diff
Ah...I see.
Perhaps, then, the maintainer should be contacted, as the desired functionality
seems similar to that provided in other all.equal
sions/3.6.2/topics/all.equal
> >> I am actually interested in the x values (x-y coordinates). Test if x-y
> >> coordinates of both 25-m-pixel rasters are the same. Ther may be a small
> >> shift or differences in the number of decimal places.
> >>
> >>
coordinates). Test if x-y
> > coordinates of both 25-m-pixel rasters are the same. Ther may be a small
> > shift or differences in the number of decimal places.
> >
> > Kind regards
> > Sibylle
> >
> >
> >
> > -Original Message-
> >
---Original Message-
From: Ivan Krylov
Sent: Friday, August 16, 2024 11:45 AM
To: sibylle.stoec...@gmx.ch
Cc: 'SIBYLLE STÖCKLI via R-help'
Subject: Re: [R] allequal diff
В Fri, 16 Aug 2024 11:32:58 +0200
пишет:
# values and mask r1
r1 <- getValues(r1)
mask1 <- is.na(r1)
#
coordinates). Test if x-y
> coordinates of both 25-m-pixel rasters are the same. Ther may be a small
> shift or differences in the number of decimal places.
>
> Kind regards
> Sibylle
>
>
>
> -Original Message-
> From: Ivan Krylov
> Sent: Friday, August 16, 202
ds
Sibylle
-Original Message-
From: Ivan Krylov
Sent: Friday, August 16, 2024 11:45 AM
To: sibylle.stoec...@gmx.ch
Cc: 'SIBYLLE STÖCKLI via R-help'
Subject: Re: [R] allequal diff
В Fri, 16 Aug 2024 11:32:58 +0200
пишет:
# values and mask r1
r1 <- getValues(r1)
mask1 <- i
Message-
From: Ivan Krylov
Sent: Friday, August 16, 2024 11:45 AM
To: sibylle.stoec...@gmx.ch
Cc: 'SIBYLLE STÖCKLI via R-help'
Subject: Re: [R] allequal diff
В Fri, 16 Aug 2024 11:32:58 +0200
пишет:
> # values and mask r1
> r1 <- getValues(r1)
> mask1 <- is.na(r
В Fri, 16 Aug 2024 11:32:58 +0200
пишет:
> # values and mask r1
> r1 <- getValues(r1)
> mask1 <- is.na(r1)
> # Do the same for r2
> r2 <- getValues(r2_resampled)
> mask2 <- is.na(r2)
>
> # Combine the masks
> all.equal(r1[!(mask1 & mask2)], r2[!(mask1 & mask2)])
Let's consider a more tangible e
x.ch
Cc: 'SIBYLLE STÖCKLI via R-help'
Subject: Re: [R] allequal diff
В Fri, 16 Aug 2024 10:35:35 +0200
пишет:
> 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 li
: R-help On Behalf Of SIBYLLE STÖCKLI via
R-help
Sent: Friday, August 16, 2024 10:36 AM
To: 'Ivan Krylov' ; 'SIBYLLE STÖCKLI via R-help'
Subject: Re: [R] allequal diff
Many thanks Ivan
Use is.na() on getValues() outputs, combine the two masks using the | operator
В Fri, 16 Aug 2024 10:35:35 +0200
пишет:
> 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
# Combin
LLE STÖCKLI via R-help
Cc: sibylle.stoec...@gmx.ch
Subject: Re: [R] allequal diff
В Fri, 16 Aug 2024 07:19:38 +0200
SIBYLLE STÖCKLI via R-help пишет:
> Is it possible to consider na.rm=TRUE?
> > all.equal(getValues(r1), getValues(r2_resampled), tolerance = 0)
>
> [1] "
В Fri, 16 Aug 2024 07:19:38 +0200
SIBYLLE STÖCKLI via R-help пишет:
> 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, combin
x27;is.NA' value mismatch: 9544032 in current 66532795 in target"
Kind regards
Sibylle
-Original Message-
From: R-help On Behalf Of Ben Bolker
Sent: Friday, August 16, 2024 1:06 AM
To: r-help@r-project.org
Subject: Re: [R] allequal diff
Digging into
Digging into the code for raster::compareRaster():
library(raster)
r <- raster(ncol=3, nrow=3)
values(r) <- 1:ncell(r)
r2 <- r
values(r2) <- c(1:8,10)
all.equal(getValues(r), getValues(r2), tolerance = 0)
[1] "Mean relative difference: 0.111"
compareRaster has fancier machinery intern
Dear community
Similar to the example of the rdocumentation, my idea is to use all.equal
and to print the difference.
https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/all.equal
> d45 <- pi*(1/4 + 1:10)
> stopifnot(
+ all.equal(tan(d45), rep(1, 10))) # TRUE, b
16 matches
Mail list logo