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, but

> all      (tan(d45) == rep(1, 10))         # FALSE, since not exactly

[1] FALSE

> all.equal(tan(d45), rep(1, 10), tolerance = 0)  # to see difference

[1] "Mean relative difference: 1.29526e-15"

>



Unfortunately, I just get "FALSE" not the difference.

> r2_resampled <- resample(r2, r1)

> compareRaster(r1, r2_resampled)

[1] TRUE

> # Compare rasters

> result <- all.equal(r1, r2_resampled)

Warning message:

In compareRaster(target, current, ..., values = values, stopiffalse =
stopiffalse,  :

  not all objects have the same values

> print(result)

[1] FALSE

>



Kind regards

Sibylle


        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to