similarity_buffer | R Documentation |
Calculates Gower's similarity index for every pixel within an given radius buffer of each sampling point
similarity_buffer( covs, pts, buffer, fac = NA, metric = "gower", stand = FALSE, ... )
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 |
a RasterStack
Colby Brungard
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.