rotate_matrix | R Documentation |
Rotates a given numeric matrix 90 degrees in a specified direction. The rotation
can be either clockwise or counterclockwise, determined by the clockwise
parameter.
rotate_matrix(x, clockwise = TRUE)
x |
A numeric matrix that is to be rotated. |
clockwise |
Logical; if TRUE (default), rotates the matrix 90 degrees clockwise. |
A numeric matrix rotated 90 degrees in the specified direction.
# Define a 3x3 matrix
matrix_original <- matrix(1:9, nrow = 3)
# Rotate the matrix clockwise
rotated_clockwise <- rotate(matrix_original, TRUE)
# Rotate the matrix counterclockwise
rotated_counterclockwise <- rotate(matrix_original, FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.