These functions provide basic summary statistics for headings
that are commonly used. For more advanced statistics on circular data,
use hdg_circular()
and the
circular package.
hdg_mean(hdg, weights = 1, na.rm = FALSE) hdg_diff(hdg, hdg_ref) hdg_sd(hdg, weights = NULL, na.rm = FALSE, bootstrap_n = 100)
hdg | A heading in degrees, where 0 is north,
90 is east, 180 is south, and 270 is west. Values
outside the range [0-360) are coerced to this range
using |
---|---|
weights | Optional weights for each value. Note that for |
na.rm | Use |
hdg_ref | A reference heading against which
to compare |
bootstrap_n | For weighted standard deviation, the number of bootstrap replicates. |
hdg_mean(-10:10)#> [1] 0#> [1] 0hdg_diff(350:370, 0)#> [1] -1.000000e+01 -9.000000e+00 -8.000000e+00 -7.000000e+00 -6.000000e+00 #> [6] -5.000000e+00 -4.000000e+00 -3.000000e+00 -2.000000e+00 -1.000000e+00 #> [11] -1.403342e-14 1.000000e+00 2.000000e+00 3.000000e+00 4.000000e+00 #> [16] 5.000000e+00 6.000000e+00 7.000000e+00 8.000000e+00 9.000000e+00 #> [21] 1.000000e+01