Description Usage Arguments Value Author(s) References Examples
View source: R/prepareTrainingData.R
Produces "presence-only", "background" and "restricted background" data to fit species distribution models. The background is selected at random within the provided raster brick or stack, while the restricted background is selected within a buffer (usually based on the maximum dispersal distance of the target species) around the presence records. The selection of background points is made by the function randomPoints
, from the dismo
package (Hijmans et al. 2017). The function can also apply thinning to the presence coordinates to reduce spatial autocorrelation through the function reduceSpatialCorrelation
. To produce pseudo-absences instead of background data, just reduce the argument n
to a number between the number and presences and twice the number of presences.
1 2 3 4 5 6 7 8 9 10 11 12 |
xy |
A data frame with two columns with coordinates x and y representing presence records. Column names are irrelevant as long as the first column represents the x coordinate, and the second column represents the y coordinate. |
variables |
A raster brick or stack with environmental variables. Must be in the same reference system of |
n |
Integer, number of background points to generate. To generate pseudo-absences just define a low n (i.e. twice the number of presences). If |
presence.only |
Boolean. If |
background |
Boolean. If |
restricted.background |
Boolean. If |
restricted.background.buffer |
Integer, buffer in kilometres around |
plot |
Boolean. If |
thinning |
Boolean. If |
minimum.distance |
Numeric, minimum distance between consecutive points in the output dataset. Defaults to the resolution of |
A data frame ready to fit an species distribution model.
Blas Benito <blasbenito@gmail.com>. The function randomPoints
is authored by Robert J. Hijmans.
Robert J. Hijmans, Steven Phillips, John Leathwick and Jane Elith (2017). dismo: Species Distribution Modeling. R package version 1.1-4. https://CRAN.R-project.org/package=dismo
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | ## Not run:
data(virtualSpecies)
data(europe2000)
#presence-only data
presence.only <- prepareTrainingData(
xy = virtualSpecies$observed.presence,
variables = europe2000,
n,
presence.only = TRUE,
plot = TRUE
)
#background
background <- prepareTrainingData(
xy = virtualSpecies$observed.presence,
variables = europe2000,
n,
background = TRUE,
plot = TRUE
)
#restricted background
restricted.background <- prepareTrainingData(
xy = virtualSpecies$observed.presence,
variables = europe2000,
n,
restricted.background = TRUE,
restricted.background.buffer = 100,
plot = TRUE
)
#applying thinning
restricted.background <- prepareTrainingData(
xy = virtualSpecies$observed.presence,
variables = europe2000,
n = 1000,
restricted.background = TRUE,
restricted.background.buffer = 100,
plot = TRUE,
thinning = TRUE,
minimum.distance = raster::xres(europe2000)
)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.