dismo (version 0.7-11)

randomPoints: Random points

Description

Generate random points that can be used to extract background values ("random-absence"). The points are sampled (without replacement) from the cells that are not 'NA' in raster 'mask'. If the coordinate reference system (of mask) is longitude/latitude, sampling is weighted by the size of the cells. That is, because cells close to the equator are larger than cells closer to the poles, equatorial cells have a higher probability of being selected.

Usage

randomPoints(mask, n, p, ext=NULL, extf=1.1, excludep=TRUE, cellnumbers=FALSE, tryf=5, warn=2)

Arguments

mask
Raster* object; Cells with NA in this object (or first layer of the object) are excluded
n
Integer. Number of points
p
Presence points (if provided, random points won't be in the same cells (as defined by mask)
ext
Exent; to restrict sampling to a spatial extent
extf
Numeric. Multiplyer to adjust the size of extent 'ext'. The default increases of 1.1 increases the extent a little (5% at each side of the extent)
excludep
Logical. If TRUE, presence points are exluded from background
cellnumbers
Logical. If TRUE, cell numbers for ]code{mask} are returned rather than coordinates
tryf
numeric > 1. Multiplyer used for initial sample size from which the requested sample size is extracted after removing NA points (outside of mask)
warn
integer. 2 or higher give most warnings. 0 or lower give no warnings if sample size n is not reached

Value

  • matrix with coordinates, or, if cellnumbers=TRUE, a vector with cell numbers.