spatiotemp_extent {dynamicSDM}R Documentation

Filter species occurrence records by a given spatial and temporal extent.

Description

Function excludes species occurrence records with co-ordinates outside a given spatial extent and record dates outside a given temporal extent.

Usage

spatiotemp_extent(
  occ.data,
  temporal.ext,
  spatial.ext,
  prj = "+proj=longlat +datum=WGS84"
)

Arguments

occ.data

a data frame, with columns for occurrence record co-ordinates and dates with column names as follows; record longitude as "x", latitude as "y", year as "year", month as "month", and day as "day".

temporal.ext

optional; a character vector, two dates in format "YYYY-MM-DD". First date represents start of temporal extent and second date represents end of temporal extent for inclusion.

spatial.ext

the spatial extent to filter by. Object from which extent can be extracted of class SpatExtent, SpatRaster, sf polygon or numeric vector listing xmin, xmax, ymin and ymax in order.

prj

a character string, the coordinate reference system of input occ.data co-ordinates. Default is "+proj=longlat +datum=WGS84".

Value

Returns data frame of occurrence records filtered to the spatial and temporal extent given.

Spatial extent

If spatial.ext is provided, spatiotemp_extent() checks whether species occurrence record co-ordinates are within the given spatial extent of the study (spatial.ext) and excludes any outside of this extent.

If spatial.ext object can be used as a mask by terra::mask() then the mask is used to filter records in a more targeted way. If not, then the rectangular extent of the spatial.ext object is used.

Temporal extent

If temporal.ext is provided, spatiotemp_extent() checks whether species occurrence record dates are within the given temporal extent of the study and excludes any outside of this extent.

Examples

data(sample_filt_data)
data(sample_extent_data)

results <- spatiotemp_extent(occ.data = sample_filt_data,
                            spatial.ext = sample_extent_data,
                            temporal.ext = c("2012-01-01", "2017-01-01"))


[Package dynamicSDM version 1.3.4 Index]