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

Hi Alex. I am getting two different bugs

SaraVarela opened this issue · comments

library (rgbif)
key <- name_backbone(name='Puma concolor')$speciesKey
dat <- occ_search(taxonKey=key, return='data', limit=100)
names (dat)
plot (dat$decimalLongitude, dat$decimalLatitude)
map (add=T)

there is a small bug in the function.
we need to change the names of the variables.
names (dat)[3:4]<- c("decimallatitude", "decimallongitude")
x<- dat

and now there is a bug. it seems that it is not reading my data and working with a default set.
I get a map of madagascar
rl <- clean_coordinates(x = x)
summary(rl)
plot(rl)

Hi Sara,

thanks for posting, and especially for the particular puma example. I have improved the plotting function a little bit, and also the handling of the outlier test in clean_coordinates, so best download the latest version from github for the students.

For your issues:
You can specify the column names in the clean_coordinates function and the plot method, using the lon and lat arguments. This is because naming can change among different data sources and it also does for GBIF depending on the download type. The default is all small caps. This works for me (v2.0-16):

library (rgbif)
library(CoordinateCleaner)

key <- name_backbone(name='Puma concolor')$speciesKey
dat <- occ_search(taxonKey=key, return='data', limit=100)

rl <- clean_coordinates(x = dat,
                        lon= "decimalLongitude",
                        lat = "decimalLatitude")
summary(rl)
plot(rl,
     lon = "decimalLongitude",
     lat = "decimalLatitude")

Unfortunately I could not reproduce the Madagascar error. This is bizarre, not sure where it could have come from. But it should also by specifying the column names in the plot function

Does that work?