Calculate a slope
get_slope(x, neighbourhood = matrix(4))
A slope value
"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.