See this slide deck where Bryan pulled this formula from: http://webspace.ship.edu/pgmarr/Geo441/Lectures/Lec

mean_azimuth(azi, len)

Arguments

azi

Azimuth of line in decimal degrees

len

Length of line in planar unit (e.g., feet)

Value

Weighted average azmimuth of line segments in decimal degrees

Examples

mean_azimuth(c(355,5),c(10,5))
#> [1] 358.3296