View source: R/penvs_bgSample.R
penvs_bgSample | R Documentation |
This function samples background points from an area determined by a rasterBrick or RasterStack of environmental layers previously cropped and masked to user determined extent.
penvs_bgSample(occs, bgMask, bgPtsNum, logger = NULL, spN = NULL)
occs |
data frame of cleaned or processed occurrences obtained from components occs: Obtain occurrence data or, poccs: Process occurrence data. |
bgMask |
a RasterStack or a RasterBrick of environmental layers cropped and masked. |
bgPtsNum |
numeric. Number of points to be sampled from the area, they will be sampled as long as <= non NA cells in any reference layer. |
logger |
Stores all notification messages to be displayed in the Log Window of Wallace GUI. Insert the logger reactive list here for running in shiny, otherwise leave the default NULL. |
spN |
data frame of cleaned occurrences obtained from component occs: Obtain occurrence data. Used to obtain species name for logger messages. |
This function is used in the select study region component. Here, a user provided amount of points is randomly sampled from the RasterBrick or RasterStack of environmental variables cropped and masked to a given background extent. The maximum number of points to be sampled is the number of non NA cells in each layer of the reference RasterBrick or RasterStack If the requested number of points is larger than the number of cells in the reference RasterBrick or RasterStack then only a proportion of the requested will be returned.
a dataframe containing point coordinates (longitude and latitude). All points are within the area provided in the RasterBrick or RasterStack (bgMask). Maximum number of points is equal to non NA cells in each layer of the reference brick or stack.
Jamie Kass <jamie.m.kass@gmail.com>
Gonzalo E. Pinilla-Buitrago <gepinillab@gmail.com>
penvs_bgMask
, penvs_bgExtent
penvs_userBgExtent
, penvs_drawBgExtent
,
randomPoints
## Not run:
occs <- occs_queryDb(spName = "Panthera onca", occDb = "gbif",
occNum = 100)
occs <- as.data.frame(occs[[1]]$cleaned)
envs <- envs_worldclim(bcRes = 10,
bcSel = c("bio03", "bio04", "bio13", "bio14"),
doBrick = TRUE)
bgExt <- penvs_bgExtent(occs, bgSel = 'bounding box', bgBuf = 0.5)
bgMask <- penvs_bgMask(occs, envs, bgExt)
bgsample <- penvs_bgSample(occs, bgMask, bgPtsNum = 1000)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.