get_slope {bespatial} | R Documentation |
Calculate a slope
Description
Calculate a slope
Usage
get_slope(x, neighbourhood = matrix(4))
Arguments
x |
A matrix |
neighbourhood |
The number of directions in which cell adjacencies are considered as neighbours: 4 (rook's case), 8 (queen's case) or a binary matrix where the ones define the neighbourhood. The default is 4. |
Details
"Slope" is calculated as follows:
For each cell, the algorithm looks at its 4 neighbors and calculates the absolute difference between the main cell and its neighbors.
Next, it sums these four values.
After repeating this operation for every cell, it calculates an average of the sum of the absolute differences for the whole raster.
Value
A slope value
[Package bespatial version 0.1.2 Index]