Generates a hexagonal grid over the AOI, downloads species occurrence records,
and assigns them to hexagons. Returns only hexagons with at least one presence
record. This is the first step of a two-stage workflow where pseudo-absences
are generated later using h3sdm_pa() after environmental variables
have been extracted with h3sdm_extract_num() and related functions.
Usage
h3sdm_pres(
species,
aoi_sf,
res = 6,
providers = NULL,
remove_duplicates = FALSE,
date = NULL,
limit = 500,
expand_factor = 0.1
)Arguments
- species
characterSpecies name (single string) for which records are requested.- aoi_sf
sfAOI (area of interest) polygon.- res
integerH3 resolution for the hexagonal grid.- providers
characterOptional vector of data providers. Accepted values: any provider supported byspocc(e.g.,"gbif","inat") plus"biodatacr"for BiodataCR (Costa Rica), queried via therbiodatacrpackage. IfNULL(default), allspoccproviders are used.- remove_duplicates
logicalRemove duplicate records at the same coordinates. Default isFALSE.- date
characterOptional date filter for records.- limit
integerMaximum number of records to download. Default is500.- expand_factor
numericFactor to expand AOI before creating the hexagonal grid. Default is0.1.
Value
sf object with columns:
h3_address: H3 index of the hexagon.presence: integer column with value1for all returned hexagons.geometry: MULTIPOLYGON of each hexagon.
Details
Unlike h3sdm_pa(), this function does not sample pseudo-absences.
It is intended to be used as the first step of a workflow where environmental
variables are extracted for the full hexagonal grid before pseudo-absences
are selected in environmental space using h3sdm_pa().
Examples
if (FALSE) { # \dontrun{
data(cr_outline_c, package = "h3sdm")
pres <- h3sdm_pres("Agalychnis callidryas", cr_outline_c, res = 7)
} # }