View source: R/env_grid_filter.R
env_grid_filter | R Documentation |
Filter the occurrence with the most realible species identification in the environmental space. This function is based in the function envSample provided by Varela et al. (2014) and were adapted to the naturaList package to select the occurrence with the most realible species identification in each environmental grid.
env_grid_filter(
occ.cl,
env.data,
grid.res,
institution.code = "institutionCode",
collection.code = "collectionCode",
catalog.number = "catalogNumber",
year = "year",
date.identified = "dateIdentified",
species = "species",
identified.by = "identifiedBy",
decimal.latitude = "decimalLatitude",
decimal.longitude = "decimalLongitude",
basis.of.record = "basisOfRecord",
media.type = "mediaType",
occurrence.id = "occurrenceID"
)
occ.cl |
data frame with occurrence records information already
classified by |
env.data |
data frame with rows for occurrence observation and columns for each environmental variable |
grid.res |
numeric vector. Each value represents the width of each bin
in the scale of the environmental variable. The order in this vector is
assumed to be the same order in the of the variables in the |
institution.code |
column name of |
collection.code |
column name of |
catalog.number |
column name of |
year |
Column name of |
date.identified |
Column name of |
species |
column name of |
identified.by |
column name of |
decimal.latitude |
column name of |
decimal.longitude |
column name of |
basis.of.record |
column name with the specific nature of the data record. See details. |
media.type |
column name of |
occurrence.id |
column name of |
Data frame with the same columns of occ.cl
.
Varela et al. (2014). Environmental filters reduce the effects of sampling bias and improve predictions of ecological niche models. *Ecography*. 37(11) 1084-1091.
classify_occ
## Not run:
library(naturaList)
library(tidyverse)
data("cyathea.br")
data("speciaLists")
data("r.temp.prec")
occ <- cyathea.br %>%
filter(species == "Cyathea atrovirens")
occ.cl <- classify_occ(occ, speciaLists, spec.ambiguity = "is.spec")
# temperature and precipitaion data
env.data <- raster::extract(
r.temp.prec,
occ.cl[,c("decimalLongitude", "decimalLatitude")]
) %>% as.data.frame()
# the bins for temperature has 5 degrees each and for precipitation has 100 mm each
grid.res <- c(5, 100)
occ.filtered <- env_grid_filter(
occ.cl,
env.data,
grid.res
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.