proximity.index: Proximity Index

View source: R/proximity.index.R

proximity.indexR Documentation

Proximity Index

Description

Calculates proximity index for a set of polygons

Usage

proximity.index(x, y = NULL, min.dist = 0, max.dist = 1000, background = NULL)

Arguments

x

A polygon class sp or sf object

y

Optional column in data containing classes

min.dist

Minimum threshold distance

max.dist

Maximum neighbor distance

background

Optional value in y column indicating background value

Value

A vector equal to nrow(x) of proximity index values, if a background value is specified NA values will be returned in the position(s) of the specified class

Author(s)

Jeffrey S. Evans <jeffrey_evans@tnc.org>

References

Gustafson, E.J., & G.R. Parker (1994) Using an Index of Habitat Patch Proximity for Landscape Design. Landscape and Urban Planning 29:117-130

Examples


 library(sf)
 if(require(sp, quietly = TRUE)) {
   data(meuse, package = "sp")
   meuse <- st_as_sf(meuse, coords = c("x", "y"), crs = 28992, 
                     agr = "constant")
   meuse <- st_buffer(meuse, dist = meuse$elev * 5)
     meuse$LU <- sample(c("forest","nonforest"), nrow(meuse), 
                       replace=TRUE) 

 # All polygon proximity index 1000 radius	
 ( pidx <- proximity.index(meuse, min.dist = 1) )
   pidx[pidx > 1000] <- 1000
 
 # Class-level proximity index 1000 radius
 ( pidx.class <- proximity.index(meuse, y = "LU", min.dist = 1) )
   
 # plot index for all polygons
 meuse$pidx <- pidx
   plot(meuse["pidx"])
 
 # plot index for class-level polygons 
 meuse$cpidx <- pidx.class
   plot(meuse["cpidx"])
 
 # plot index for just forest class
 forest <- meuse[meuse$LU == "forest",]
  plot(forest["cpidx"])

} else { 
  cat("Please install sp package to run example", "\n")
}
   

spatialEco documentation built on Nov. 18, 2023, 1:13 a.m.