sine(), cosine(), tangent(), secant(), cosecant(), and cotangent() are
angle() aware trigonometric functions that allow for a user chosen angular unit.
Usage
sine(x, unit = getOption("affiner_angular_unit", "degrees"))
cosine(x, unit = getOption("affiner_angular_unit", "degrees"))
tangent(x, unit = getOption("affiner_angular_unit", "degrees"))
secant(x, unit = getOption("affiner_angular_unit", "degrees"))
cosecant(x, unit = getOption("affiner_angular_unit", "degrees"))
cotangent(x, unit = getOption("affiner_angular_unit", "degrees"))Arguments
- x
An angle vector or an object to convert to it (such as a numeric vector)
- unit
A string of the desired angular unit. Supports the following strings (note we ignore any punctuation and space characters as well as any trailing
s's e.g. "half turns" will be treated as equivalent to "halfturn"):"deg" or "degree"
"half-revolution", "half-turn", or "pi-radian"
"gon", "grad", "grade", or "gradian"
"rad" or "radian"
"rev", "revolution", "tr", or "turn"
Examples
sine(pi, "radians")
#> [1] 0
cosine(180, "degrees")
#> [1] -1
tangent(0.5, "turns")
#> [1] 0
a <- angle(0.5, "turns")
secant(a)
#> [1] Inf
cosecant(a)
#> [1] -1
cotangent(a)
#> [1] Inf
