CoordinateCleaner
CoordinateCleaner copied to clipboard
Wondering why defaults for lon and lat use lowercase when GBIF downloads use camelCase
cc_cen <- function(x,
lon = "decimallongitude",
lat = "decimallatitude",
species = "species",
buffer = 1000,
geod = TRUE,
test = "both",
ref = NULL,
verify = FALSE,
value = "clean",
verbose = TRUE)
gbif_download %>%
cc_cen(
lon = "decimallongitude",
lat = "decimallatitude",
buffer = 2000,
value = "clean")
error in evaluating the argument 'obj' in selecting a method for function 'coordinates': Can't subset columns that don't exist. x Columns
decimallongitude
anddecimallatitude
don't exist.
Same problem here. I just used the example given for Panthera leo (https://ropensci.github.io/CoordinateCleaner/articles/Cleaning_GBIF_data_with_CoordinateCleaner.html) and got the same error message:
library(countrycode)
library(CoordinateCleaner)
library(dplyr)
library(ggplot2)
library(rgbif)
library(sp)
#obtain data from GBIF via rgbif
dat <- occ_search(scientificName = "Panthera leo", limit = 5000, hasCoordinate = T)
dat <- dat$data
names(dat) #a lot of columns
#select columns of interest
dat <- dat %>%
dplyr::select(species, decimalLongitude, decimalLatitude, countryCode, individualCount,
gbifID, family, taxonRank, coordinateUncertaintyInMeters, year,
basisOfRecord, institutionCode, datasetName)
remove records without coordinates
dat <- dat%>%
filter(!is.na(decimalLongitude))%>%
filter(!is.na(decimalLatitude))
#to avoid specifying it in each function
names(dat)[2:3] <- c("decimallongitude", "decimallatitude")
clean <- dat%>%
cc_val()%>%
cc_equ()%>%
cc_cap()%>%
cc_cen()%>%
cc_coun(iso3 = "countryCode")%>%
cc_gbif()%>%
cc_inst()%>%
cc_sea()%>%
cc_zero()%>%
cc_outl()%>%
cc_dupl()
Testing duplicates Testing zero coordinates Testing sea coordinates Testing biodiversity institutions Testing GBIF headquarters, flagging records around Copenhagen Testing country centroids Testing country capitals Testing equal lat/lon Testing coordinate validity Removed 0 records. Removed 6 records. Removed 22 records. Removed 7 records. Testing country identity Removed 4618 records. Error in h(simpleError(msg, call)) : error in evaluating the argument 'obj' in selecting a method for function 'coordinates': cannot derive coordinates from non-numeric matrix In addition: Warning message: In wkt(obj) : CRS object has no comment
This seems like a different thing. I opened a new issue and replied there.