Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean_coordinates fails if zeros_rad = 0 #67

Open
AMBarbosa opened this issue Mar 11, 2022 · 0 comments
Open

clean_coordinates fails if zeros_rad = 0 #67

AMBarbosa opened this issue Mar 11, 2022 · 0 comments

Comments

@AMBarbosa
Copy link
Contributor

Hello,
clean_coordinates works OK with the defaults, but it fails if we change zeros_rad to 0, i.e. if we want to remove records only if they have exactly 0 lon / lat:

exmpl <- data.frame(species = sample(letters, size = 250, replace = TRUE),
                    decimallongitude = runif(250, min = 42, max = 51),
                    decimallatitude = runif(250, min = -26, max = -11))

test <- clean_coordinates(x = exmpl, tests = "zeros", zeros_rad = 0)

# Testing coordinate validity
# Flagged 0 records.
# Testing zero coordinates
# Error in (function (classes, fdef, mtable)  : 
#             unable to find an inherited method for function ‘over’ for signature ‘"SpatialPoints", "NULL"’

If this is purposeful or difficult to fix, at least it should be mentioned in the description of this argument in the help file, so that users are not not puzzled by the error. Or you could add a line inside the function to turn zeros_rad to a very small value if the user has set it to 0 -- something like:
if (zeros_rad == 0) zeros_rad <- 0.000000000000001
Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant