Description Usage Arguments Details Value Examples
Adds covariates to a habitat mask from a GIS landcover data in raster format.
1 2 |
mask |
|
raster |
list with components x,y, and z in the same style as used by
contour, persp, image etc. x and y are the X and Y grid values and z is a
matrix with the corresponding values of the surface (this gets passed to
|
names |
names to associate with the values in |
distance.to |
names of any layers for which ‘distance to’ covariates are to be calcuated |
drop |
names of layers to be deleted from the mask |
plot |
if TRUE then an image plot will be drawn using
|
cols |
colours to associate with the layers (only used if |
domulti |
logical for categorical integer variable (like land use class) into columns of binary data for each category at each mask point if TRUE. If FALSE then treats creates a single column with the integer integer values. |
NOTE: This is a function under development, with rather limited and
specific functionality. The secr
function addCovariates
is probably more useful at this stage. If typeof(raster$z) = "double"
then elements of
raster$z
are assumed to represent a single layer type. If
typeof(raster$z) = "integer"
then each unique integer is assumed to
represent a unique landcover type. If the mask already contains covariates
whose names are identical to those supplied in names
then these will
be overwritten.
Returns a new mask object.
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 | # load mask and raster data
data(Boland.leopards1)
data(Boland.landuse.image)
data(Boland.alt.image)
# save par settings
op = par(no.readonly = TRUE)
# single landcover type
par(mfrow = c(1,1), mar = c(2,2,2,2), oma = c(0,0,0,0))
newmask = addcov2mask(Boland.mask1, Boland.alt.image, "altitude")
head(covariates(newmask))
# mutiple landcover types
newmask = addcov2mask(
Boland.mask1, Boland.landuse.image,
names = c("Unknown", "Natural", "Cultivated", "Degraded", "Urban", "Water", "Plantation"),
cols = c("black", "green3", "yellow", "tan", "dimgray", "blue", "gold2"),
)
head(covariates(newmask))
# mutiple landcover types - including distance to water and urbarn
par(mfrow = c(1,3))
newmask = addcov2mask(
Boland.mask1, Boland.landuse.image,
names = c("Unknown", "Natural", "Cultivated", "Degraded", "Urban", "Water", "Plantation"),
cols = c("black", "green3", "yellow", "tan", "dimgray", "blue", "gold2"),
distance.to = c("Urban","Water")
)
head(covariates(newmask))
# mutiple landcover types - including distance to water and urbarn (and deleting these mask points)
newmask = addcov2mask(
Boland.mask1, Boland.landuse.image,
names = c("Unknown", "Natural", "Cultivated", "Degraded", "Urban", "Water", "Plantation"),
cols = c("black", "green3", "yellow", "tan", "dimgray", "blue", "gold2"),
distance.to = c("Urban","Water"),
drop = c("Urban","Water")
)
head(covariates(newmask))
# reset par settings
par(op)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.