ropensci / CoordinateCleaner

Automated flagging of common spatial and temporal errors in biological and palaeontological collection data, for the use in conservation, ecology and palaeontology.
https://docs.ropensci.org/CoordinateCleaner/
79 stars 21 forks source link

Problem replacing ref in cc_cen #19

Closed jhnwllr closed 4 years ago

jhnwllr commented 5 years ago

When I try to replace the ref argument in with just a filtered version of CoordinateCleaner::countryref in cc_cen I get an this error:

library(tibble)
library(dplyr)

D = tribble(
~method, ~lat,  ~long,
"Centre of Gravity Method", -23.1166667, 132.33333,
"Lambert Gravitational Centre", -25.9470278, 133.2096389,
"Furthest Point from Coastline", -23.033333, 132.1666667,
"Geodetic Median Point", -23.5527472, 133.396111,
"Johnston Geodetic Station", -25.0000, 135.0000
) %>% as.data.frame()

# replacement ref
ref = CoordinateCleaner::countryref %>% 
filter(iso2=="AU") %>%
filter(type == "country")

CoordinateCleaner::cc_cen(D,
                   lon = "long",
                   lat = "lat", 
                   buffer = 1000,
                   test = "both", 
                   ref = ref,
                   verify = FALSE,
                   value = "clean", 
                   verbose = TRUE)

I get this error:

unable to find an inherited method for function 'proj4string<-' for signature '"data.frame", "character"'
Calls: <Anonymous> -> proj4string<- -> <Anonymous>
Execution halted
azizka commented 4 years ago

This was a bug in the cc_cen code, fixed as of version 2.0-14