Very simple function to apply a kernel to a matrix across a moving window.
Usage
movingwindow(x, kernel, na.rm=TRUE)
Value
Returns the transformed matrix.
Arguments
x
A matrix.
kernel
The kernel to be applied to the matrix, for example a Sobel kernel.
na.rm
NA handling option to be passed to sum(). If TRUE, NA will be returned if any value under the kernel is NA or NaN, otherwise NA values will be omitted.
Author
Sarah Goslee
Details
This function is used in the calculation of slope and aspect by slopeasp().