similarity_buffer: Gower similarity analysis

Description Usage Arguments Value Author(s) References Examples

View source: R/similarity.R

Description

Calculates Gower's similarity index for every pixel within an given radius buffer of each sampling point

Usage

1
2
3
4
5
6
7
8
9
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 daisy from the cluster package for more details

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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)

clhs documentation built on Oct. 14, 2021, 9:06 a.m.