Computes the magnitude of a vector of any dimension. Or angle (in degrees) in 2 dimensions.
Mag(...)
Angle(x, y)
Mag
: A numeric vector the same length as each element of ...
that is \(\sqrt(x^2 + y^2 + ...)\).
Angle
: A numeric vector of the same length as x and y that is
atan2(y, x)*180/pi
.
Helpful to save keystrokes and gain readability when computing wind (or any other vector quantity) magnitude.
Other utilities:
Anomaly()
,
JumpBy()
,
Percentile()
,
logic
Other utilities:
Anomaly()
,
JumpBy()
,
Percentile()
,
logic
Mag(10, 10)
#> [1] 14.14214
Angle(10, 10)
#> [1] 45
Mag(10, 10, 10, 10)
#> [1] 20
Mag(list(10, 10, 10, 10))
#> [1] 20
# There's no vector recicling!
if (FALSE) { # \dontrun{
Mag(1, 1:2)
} # }