ropensci / CoordinateCleaner

Automated flagging of common spatial and temporal errors in biological and palaeontological collection data, for the use in conservation, ecology and palaeontology.

Home Page:https://docs.ropensci.org/CoordinateCleaner/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with geographic outliers

Adrien-Noirault opened this issue · comments

Hi !

I have a problem running cc_outl, it send me an error:
Testing geographic outliers
Flagged NA records
.

When I run it with clean_coordinates, it send me another error but always for geographic outliers:
Error in $<-.data.frame(*tmp*, "otl", value = c(FALSE, TRUE, TRUE, :
replacement has 7583 rows, data has 7153

I give you my code and the species I used:

Abeliophyllum distichum (data from GBIF, ALA4R and BIEN are used)
occ_reduced_ Abeliophyllum distichum .xlsx

TEST3=clean_coordinates(TEST2, lon = "Longitude", lat = "Latitude",
species = "Species_TNRS", countries = NULL,
tests = c("capitals","centroids", "equal", "gbif", "institutions", "outliers", "seas","zeros"),
capitals_rad = 10000, centroids_rad = 1000,
centroids_detail = "both", inst_rad = 100,
outliers_method = "quantile", outliers_mtp = 5, outliers_td = 1000,
outliers_size = 7, range_rad = 0, zeros_rad = 0.5,
capitals_ref = NULL, centroids_ref = NULL, country_ref = NULL,
inst_ref = NULL, range_ref = NULL, seas_ref = NULL,
seas_scale = 50, urban_ref = NULL, value = "clean",
verbose = TRUE)

or

TEST10=cc_outl(TEST9, lon = "Longitude", lat = "Latitude",
species = "Species_TNRS",
value = "flagged", min_occs = 7)

It would be greatful if you could help me solving this problem.
Thanks a lot for your answer and for the package itself !

Hi,

I couldn't reproduce your error, but when loading your example, there was a problem with non-numeric and missing coordinates. The following works for me using the latest version of CoordinateCleaner, dat being your example data:


dat$Longitude <- as.numeric(dat$Longitude)
dat$Latitude <- as.numeric(dat$Latitude)

dat <-  dat[!is.na(dat$Longitude),]

cc_outl(x = dat, species = "Species_TNRS",
        lon = "Longitude", lat = "Latitude",
        value = "flagged", min_occs = 7)

Does that help?

I'll close this issue now