Learn R Programming

sdetorus (version 0.1.10)

toPiInt: Wrapping of radians to its principal values

Description

Utilities for transforming a reals into \([-\pi, \pi)\), \([0, 2\pi)\) or \([a, b)\).

Usage

toPiInt(x)

to2PiInt(x)

toInt(x, a, b)

Value

The wrapped vector in the chosen interval.

Arguments

x

a vector, matrix or object for whom Arithmetic is defined.

a, b

the lower and upper limits of \([a, b)\).

Details

Note that \(b\) is excluded from the result, see examples.

Examples

Run this code
# Wrapping of angles
x <- seq(-3 * pi, 5 * pi, l = 100)
toPiInt(x)
to2PiInt(x)

# Transformation to [1, 5)
x <- 1:10
toInt(x, 1, 5)
toInt(x + 1, 1, 5)

# Transformation to [1, 5]
toInt(x, 1, 6)
toInt(x + 1, 1, 6)

Run the code above in your browser using DataLab