get_nearestneighbour: get_nearestneighbour

Description Usage Arguments Details References Examples

View source: R/get_nearestneighbour.R

Description

Euclidean distance to nearest neighbour

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
get_nearestneighbour(landscape)

## S3 method for class 'RasterLayer'
get_nearestneighbour(landscape)

## S3 method for class 'RasterStack'
get_nearestneighbour(landscape)

## S3 method for class 'RasterBrick'
get_nearestneighbour(landscape)

## S3 method for class 'stars'
get_nearestneighbour(landscape)

## S3 method for class 'list'
get_nearestneighbour(landscape)

## S3 method for class 'matrix'
get_nearestneighbour(landscape)

Arguments

landscape

RasterLayer or matrix (with x,y,id columns)

Details

Fast and memory safe Rcpp implementation for calculating the minimum Euclidean distances to the nearest patch of the same class in a raster or matrix. All patches need an unique ID (see get_patches).

References

Based on RCpp code of Florian Priv<c3><a9> [email protected]

Examples

1
2
3
4
5
6
7
8
9
# get patches for class 1 from testdata as raster
class_1 <- get_patches(landscape,1)[[1]]

# calculate the distance between patches
get_nearestneighbour(class_1)

# do the same with a 3 column matrix (x, y, id)
class_1_matrix <- raster::rasterToPoints(class_1)
get_nearestneighbour(class_1_matrix)

r-spatialecology/landscapemetrics documentation built on April 30, 2019, 6:01 a.m.