similarity_buffer {clhs} | R Documentation |
Gower similarity analysis
Description
Calculates Gower's similarity index for every pixel within an given radius buffer of each sampling point
Usage
similarity_buffer(
covs,
pts,
buffer,
fac = NA,
metric = "gower",
stand = FALSE,
...
)
Arguments
covs |
raster stack of environmental covariates |
pts |
sampling points, object of class SpatialPointsDataframe |
buffer |
Radius of the disk around each point that similarity will be calculated |
fac |
numeric, can be > 1, (e.g., fac = c(2,3)). Raster layer(s) which are categorical variables. Set to NA if no factor is present |
metric |
character string specifying the similarity metric to be used. The currently available options are "euclidean", "manhattan" and "gower" (the default). See |
stand |
logical flag: if TRUE, then the measurements in x are standardized before calculating the dissimilarities. |
... |
passed to plyr::llply |
Value
a RasterStack
Author(s)
Colby Brungard
References
Brungard, C. and Johanson, J. 2015. The gate's locked! I can't get to the exact sampling spot... can I sample nearby? Pedometron, 37:8–10.
Examples
library(raster)
library(sp)
data(meuse.grid)
coordinates(meuse.grid) = ~x+y
proj4string(meuse.grid) <- CRS("+init=epsg:28992")
gridded(meuse.grid) = TRUE
ms <- stack(meuse.grid)
suppressWarnings(RNGversion("3.5.0"))
set.seed(1)
pts <- clhs(ms, size = 3, iter = 100, progress = FALSE, simple = FALSE)
gw <- similarity_buffer(ms, pts$sampled_data, buffer = 500)
plot(gw)