Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ecospat.sample.envar

Sample Environmental Variables


Description

Add environmental values to a species dataframe.

Usage

ecospat.sample.envar (dfsp, colspxy, colspkept = "xy", dfvar, 
colvarxy, colvar = "all", resolution)

Arguments

dfsp

A species dataframe with x (long), y (lat) and optional other variables.

colspxy

The range of columns for x (long) and y (lat) in dfsp.

colspkept

The columns of dfsp that should be kept in the final dataframe (default: xy).

dfvar

A dataframe object with x, y and environmental variables.

colvarxy

The range of columns for x and y in dfvar.

colvar

The range of enviromental variable columns in dfvar (default: all except xy).

resolution

The distance between x,y of species and environmental datafreme beyond which values shouldn't be added.

Details

The xy (lat/long) coordinates of the species occurrences are compared to those of the environment dataframe and the value of the closest pixel is added to the species dataframe. When the closest environment pixel is more distant than the given resolution, NA is added instead of the value. This function is similar to sample() in ArcGIS.

Value

A Dataframe with the same rows as dfsp, with environmental values from dfvar in column.

Author(s)

Olivier Broennimann olivier.broennimann@unil.ch

Examples

data("ecospat.testNiche")
spp <- ecospat.testNiche
sp1 <- spp[1:32,2:3]
names(sp1)<-c("x","y")
occ.sp1 <- ecospat.occ.desaggregation(xy=sp1,min.dist=500)
clim <- ecospat.testData[2:8]

occ_sp1 <- na.exclude(ecospat.sample.envar(dfsp=occ.sp1,colspxy=1:2,colspkept=1:2,
                                            dfvar=clim,colvarxy=1:2,colvar="all",resolution=25))

ecospat

Spatial Ecology Miscellaneous Methods

v3.2
GPL
Authors
Olivier Broennimann [cre, aut, ctb], Valeria Di Cola [aut, ctb], Blaise Petitpierre [ctb], Frank Breiner [ctb], Daniel Scherrer [ctb], Manuela D`Amen [ctb], Christophe Randin [ctb], Robin Engler [ctb], Wim Hordijk [ctb], Heidi Mod [ctb], Julien Pottier [ctb], Mirko Di Febbraro [ctb], Loic Pellissier [ctb], Dorothea Pio [ctb], Ruben Garcia Mateo [ctb], Anne Dubuis [ctb], Luigi Maiorano [ctb], Achilleas Psomas [ctb], Charlotte Ndiribe [ctb], Nicolas Salamin [ctb], Niklaus Zimmermann [ctb], Antoine Guisan [aut]
Initial release
2021-02-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.