Learn R Programming

phonTools (version 0.2-1.1)

rotate: Rotate

Description

Rotate 2D and complex-valued observations.

Usage

rotate (xy, angle, degrees = FALSE)

Arguments

xy
Either, a vector of complex-valued observations, or a matrix with 2 columns and any number of rows.
angle
The desired angle of rotation, in radians.
degrees
If degrees are provided instead of radians, this should be set to TRUE.

Details

The output is of the same kind as the input.

Examples

Run this code
## rotate points in a 2D space 
mat = cbind (1:100, 100:1)
rotate (mat, pi/2)

## rotate complex-valued numbers
complx = complex (real = mat[,1], imaginary = mat[,2])
rotate (complx, pi/2)

Run the code above in your browser using DataLab