similar to: allequal diff

Displaying 20 results from an estimated 500 matches similar to: "allequal diff"

2024 Aug 15
1
allequal diff
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.1111111" compareRaster has fancier machinery internally for doing the comparison for large rasters a block at a time if everything
2024 Aug 16
1
allequal diff
Dear Ben Many thanks. I see that a second challenge are NA values. Is it possible to consider na.rm=TRUE? > r2_resampled <- resample(r2, r1) > compareRaster(r1, r2_resampled) [1] TRUE > > all.equal(getValues(r1), getValues(r2_resampled), tolerance = 0) [1] "'is.NA' value mismatch: 9544032 in current 66532795 in target" Kind regards Sibylle
2024 Aug 18
1
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 methods. I realize that this may often not elicit a (prompt) response. -- Bert On Sun, Aug 18, 2024 at 11:50?AM Ben Bolker <bbolker at gmail.com> wrote: > > The OP's original problem is that the all.equal method for raster >
2024 Aug 18
1
allequal diff
?? The OP's original problem is that the all.equal method for raster objects (raster:::all.equal.raster), which is a wrapper around the compareRaster() function, compares a bunch of different properties of rasters (extent, resolution, values, etc.) and only returns a single overall logical (TRUE/FALSE) value. OP wanted to see the magnitude of the difference (as you could get for more
2024 Aug 18
2
allequal diff
"Is it true that all.equal just compares y values?" The following may be a bit more than you may have wanted, but I hope it is nevertheless useful. The first place you should go to for questions like this is the Help system, not here, i.e. ?all.equal When you do this, you will find that all.equal() is a so-called S3 generic function, which, among other things, means that it works
2024 Aug 16
2
allequal diff
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
2024 Aug 18
2
allequal diff
Dear Ivan Thanks a lot for this very nice example. Is it true that all.equal just compares y values? Based on this help here I think so and the value I got is the difference for the y-values. https://www.statology.org/all-equal-function-r/ However, here I see x and y testing? https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/all.equal I am actually interested in the x values
2024 Aug 16
1
allequal diff
? Fri, 16 Aug 2024 10:35:35 +0200 <sibylle.stoeckli at 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],
2024 Aug 16
1
allequal diff
Cool thanks # 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)]) output > all.equal(r1[!(mask1 & mask2)], r2[!(mask1 & mask2)]) [1] "'is.NA' value mismatch: 389 in current 56989152 in target"
2024 Aug 16
1
allequal diff
? Fri, 16 Aug 2024 11:32:58 +0200 <sibylle.stoeckli at gmx.ch> ?????: > # 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 example: # The
2024 Aug 16
1
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
2011 Jun 09
1
Error: missing values where TRUE/FALSE needed
I'm writing a function and keep getting the following error message. myfunc <- function(lst) { lst <- list(roots = c("car insurance", "auto insurance"), roots2 = c("insurance"), prefix = c("cheap", "budget"), prefix2 = c("low cost"), suffix = c("quote", "quotes"), suffix2 = c("rate",
2011 Jun 09
2
Problem with a if statement inside a function
I have a really long functions, and at the end of the function, I am using a if statement to tag certain keywords based on whether they have certain values contained in them. However, the if statement doesn't seem to work. When I had split up the commands into various functions, it worked fine, but I'm not sure what going on now that it's combined into a single function. myfunc
2011 Jun 09
1
Trying to make code more efficient
I have a repetative task in R and i'm trying to find a more efficient way to perform the following task. lst <- list(roots = c("car insurance", "auto insurance"), roots2 = c("insurance"), prefix = c("cheap", "budget"), prefix2 = c("low cost"), suffix = c("quote", "quotes"),
2009 Jun 17
4
searching help for partial matches
The situation is that I know there is a function and know approximately what the name is, and want to find the exact name. Is there a way of searching for near-matches (similar to unix apropos). For example, I know there is a function called something like allequal (or allequals or AllEquals or...). But ?allequal, etc, return nothing, only if I remember the name can I get help via ?all.equal.
2013 Mar 18
4
Why stacking rasters return NAs?
I have several rasters that I want to do some calculations ,basically calculating the moving average. dir2 <- list.files("D:\\2010+2011", "*.bin", full.names = TRUE) saf=stack(dir2) movi <- overlay(stack(saf),fun=function(x) movingFun(x, fun=mean, n=3, na.rm=TRUE)) Error in .overlayList(x, fun = fun, filename = filename,
2016 Sep 08
2
Fwd: Re: RSiteSearch, sos, rdocumentation.org, ...?
On 8 September 2016 at 06:01, Jonathan Baron wrote: | We have over 10,000 packages now. I wonder if searching all help files | is really helpful anymore. Yes it is. I go to http://rdocumentation.org a lot for quick look-ups. So thanks to Datacamp for running that. Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
2016 Sep 08
0
Fwd: Re: RSiteSearch, sos, rdocumentation.org, ...?
I looked at rdocumentation.org. At first I thought it was a superior replacement for namazu, but after I tried a few things I decided that it wasn't. I could not find any documentation about how to search, and the various things I tried seemed to yield very strange responses, e.g., a search for "Hayes mediation bootstrap" gave me mostly functions that had nothing to do with the
2017 Dec 07
2
parallel computing with foreach()
I have used foreach() for parallel computing but in the current problem, it is not working. Given the volume and type of the data involved in the analysis, I will try to give below the complete code without reproducible example. In short, each R environment will draw a set of separate files, perform the analysis and dump in separate folders. splist <- c("juoc", "juos",
2016 Dec 17
0
Fwd: Re: RSiteSearch, sos, rdocumentation.org, ...?
Hi, Jonathan: Thanks for letting us know. I can't imagine that the unavailability of RSiteSearch would be more than an inconvenience. When you get time, I'd like to know more about what you know about how it was hacked, the host operating system, any anti-virus / Internet protection software that failed and anything you think might reduce the risk of a repeat in the