Learn R Programming

affiner (version 0.1.3)

as_angle: Cast to angle vector

Description

as_angle() casts to an angle() vector

Usage

as_angle(x, unit = getOption("affiner_angular_unit", "degrees"), ...)

# S3 method for angle as_angle(x, unit = getOption("affiner_angular_unit", "degrees"), ...)

# S3 method for character as_angle(x, unit = getOption("affiner_angular_unit", "degrees"), ...)

# S3 method for complex as_angle(x, unit = getOption("affiner_angular_unit", "degrees"), ...)

# S3 method for Coord2D as_angle(x, unit = getOption("affiner_angular_unit", "degrees"), ...)

# S3 method for Coord3D as_angle( x, unit = getOption("affiner_angular_unit", "degrees"), type = c("azimuth", "inclination"), ... )

# S3 method for Line2D as_angle(x, unit = getOption("affiner_angular_unit", "degrees"), ...)

# S3 method for Plane3D as_angle( x, unit = getOption("affiner_angular_unit", "degrees"), type = c("azimuth", "inclination"), ... )

# S3 method for numeric as_angle(x, unit = getOption("affiner_angular_unit", "degrees"), ...)

Value

An angle() vector

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.

Examples

Run this code
as_angle(angle(pi, "radians"), "pi-radians")
as_angle(complex(real = 0, imaginary = 1), "degrees")
as_angle(as_coord2d(x = 0, y = 1), "turns")
as_angle(200, "gradians")

Run the code above in your browser using DataLab