rotate90 | R Documentation |
Matrix or Array Rotation by 90 Degrees
rotate90(img, direction = "positive")
img |
an array or a matrix |
direction |
The direction of rotation by 90 degrees.
The value can be |
The function takes an array or matrix as input
object (img
) and returns the object rotated by
90 degrees. Per default, the rotation is done in the
mathematically positive direction (i.e.,
counterclockwise). Clockwise rotation (i.e.,
mathematically negative) can be specified by passing
the value "negative"
to the direction
argument.
an array or a matrix (rotated by 90 degrees)
# sample matrix
img <- matrix(1:6, ncol = 2)
img
rotate90(img) # counterclockwise
rotate90(img, direction = "negative") # clockwise
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.