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
Or combined in a single function (based on Eric Leschinski):
rotate <- function(x, clockwise=T) { if (clockwise) { t( apply(x, 2, rev)) } else {apply( t(x),2, rev)} }