powered by
rot90(a, k = 1)
Value of k is taken mod 4.
a <- matrix(1:12, nrow=3, ncol=4, byrow=TRUE) rot90(a) rot90(a, 2) rot90(a, -1)
Run the code above in your browser using DataLab