Learn R Programming

PET (version 0.5.1)

rotate: Rotates Data

Description

The function implements the rotation of a vector, a matrix or a 3-dimensional array.

Usage

rotate(A, grad = 90)

Arguments

A

Is a vector, a matrix or a 3-dimensional array.

grad

Can be set to 0, 90, 180, 270, -90, -180 or -270. Defaults to grad = 90.

Value

Returns the rotated data.

Examples

Run this code
# NOT RUN {
# Rotation of a vector
(x <- c(1:5))
rotate(x,270)
rm(x)

# Rotation of a matrix
(A <- matrix(1:15, nrow=3))
rotate(A, -90)
rm(A)

# Rotation of an array
(A <- array(1:20, c(2,5,2)))
rotate(A, 180)
rm(A)
# }

Run the code above in your browser using DataLab