spocc (version 0.2.4)

clean_spocc: Clean spocc data

Description

Clean spocc data

Usage

clean_spocc(input, country = NULL, country_which = "include",
  shppath = NULL, habitat = NULL, provider_duplicates = FALSE)

Arguments

input
An object of class occdat
country
(logical) Attempt to clean based on country. Ignored for now.
country_which
(character) One of include, xxx. Ignored for now.
shppath
(character) Path to shape file to check against. Ignored for now.
habitat
(character) Attempt to clean based on habitat. Ignored for now.
provider_duplicates
(logical) Whether to remove duplicates from the same provider in separate sources. Ignored for now.

Value

  • Returns an object of class occdat+occlean. See attributes of the return object for details on cleaning results.

Details

We'll continue to add options for cleaning data, but for now, this function:

  • Removes impossible values of latitude and longitude
  • Removes any NA values of latitude and longitude
  • Removes points at 0,0 - these points are likely wrong

Some examples below don't actually work yet, but will soon.

Examples

Run this code
res <- occ(query = c('Ursus','Accipiter','Rubus'), from = 'bison', limit=10)
class(res)
res_cleaned <- clean_spocc(input=res)
class(res_cleaned) # now with classes occdat and occclean

#### THESE AREN'T WORKING...
# Country cleaning
res <- occ(query = 'Ursus americanus', from = 'gbif', limit=500,
   gbifopts = list(hasCoordinate=TRUE))
res$gbif
plot(res)

res <- occ(query = 'Ursus americanus', from = 'gbif', limit=1200,
   gbifopts = list(hasCoordinate=TRUE))
plot(res)
res2 <- clean_spocc(res, country = "Mexico")
plot(res2)

# Clean provider duplicates
res <- occ(query = 'Ursus americanus', from = c('gbif','inat'), limit=300)
plot(res)
res2 <- clean_spocc(input=res, provider_duplicates = TRUE)

Run the code above in your browser using DataLab