as_angle() casts to an angle() vector
Usage
as_angle(x, unit = getOption("affiner_angular_unit", "degrees"), ...)
# S3 method for class 'angle'
as_angle(x, unit = getOption("affiner_angular_unit", "degrees"), ...)
# S3 method for class 'character'
as_angle(x, unit = getOption("affiner_angular_unit", "degrees"), ...)
# S3 method for class 'complex'
as_angle(x, unit = getOption("affiner_angular_unit", "degrees"), ...)
# S3 method for class 'Coord2D'
as_angle(x, unit = getOption("affiner_angular_unit", "degrees"), ...)
# S3 method for class 'Coord3D'
as_angle(
x,
unit = getOption("affiner_angular_unit", "degrees"),
type = c("azimuth", "inclination"),
...
)
# S3 method for class 'Line2D'
as_angle(x, unit = getOption("affiner_angular_unit", "degrees"), ...)
# S3 method for class 'Plane3D'
as_angle(
x,
unit = getOption("affiner_angular_unit", "degrees"),
type = c("azimuth", "inclination"),
...
)
# S3 method for class 'numeric'
as_angle(x, unit = getOption("affiner_angular_unit", "degrees"), ...)Arguments
- x
An R object to convert to a
angle()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"
- ...
Further arguments passed to or from other methods
- type
Use "azimuth" to calculate the azimuthal angle and "inclination" to calculate the inclination angle aka polar angle.
Value
An angle() vector
Examples
as_angle(angle(pi, "radians"), "pi-radians")
#> <angle<pi-radians>[1]>
#> [1] 1π rad
as_angle(complex(real = 0, imaginary = 1), "degrees")
#> <angle<degrees>[1]>
#> [1] 90°
as_angle(as_coord2d(x = 0, y = 1), "turns")
#> <angle<turns>[1]>
#> [1] 0.25 tr
as_angle(200, "gradians")
#> <angle<gradians>[1]>
#> [1] 200 gon
