trigonometric-functions: Angle vector aware trigonometric functions

trigonometric-functionsR Documentation

Angle vector aware trigonometric functions

Description

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"

Value

A numeric vector

Examples

sine(pi, "radians")
cosine(180, "degrees")
tangent(0.5, "turns")

a <- angle(0.5, "turns")
secant(a)
cosecant(a)
cotangent(a)

affiner documentation built on April 4, 2025, 4:42 a.m.