Last active
July 18, 2026 20:19
-
-
Save jonesor/1cb7178db13ee4f002d5 to your computer and use it in GitHub Desktop.
Rotate a matrix through 90 degrees clockwise
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Rotate a matrix through 90 degrees clockwise. | |
| # drop = FALSE keeps the result a matrix even when m has a single row. | |
| m <- t(m[nrow(m):1, , drop = FALSE]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment