direction.RdThe direction (azimuth) to or from the nearest cell that is not NA. The direction unit is in radians, unless you use argument degrees=TRUE.
# S4 method for class 'RasterLayer'
direction(x, filename='', degrees=FALSE, from=FALSE, doEdge=FALSE, ...)RasterLayer object
Character. Output filename (optional)
Logical. If FALSE (the default) the unit of direction is radians.
Logical. Default is FALSE. If TRUE, the direction from (instead of to) the nearest cell that is not NA is returned
Logical. If TRUE, the boundaries function is called first. This may be efficient in cases where you compute the distance to large blobs. Calling boundaries determines the edge cells that matter for direction computation
Additional arguments as for writeRaster
RasterLayer
For the direction between (longitude/latitude) points, see the azimuth function in the geosphere package