I have a matrix in R like this:
|1|2|3| |1|2|3| |1|2|3|
Is there an easy way to rotate the entire matrix by 90 degrees clockwise to get the
m <- matrix(rep(1:3,each=3),3) [,1] [,2] [,3] [1,] 1 2 3 [2,] 1 2 3 [3,] 1 2 3 t(m[nrow(m):1,]) [,1] [,2] [,3] [1,] 1 1 1 [2,] 2 2 2 [3,] 3 3 3 m[nrow(m):1,ncol(m):1] [,1] [,2] [,3] [1,] 3 2 1 [2,] 3 2 1 [3,] 3 2 1 t(m)[ncol(m):1,] [,1] [,2] [,3] [1,] 3 3 3 [2,] 2 2 2 [3,] 1 1 1