flipdim(a, dim)
flipud(a)
fliplr(a)
flipdim
will flip a matrix along the dim
dimension, where
dim=1
means flipping rows, and dim=2
flipping the columns.flipud
and fliplr
are simply shortcuts for flipdim(a, 1)
resp. flipdim(a, 2)
.
a <- matrix(1:12, nrow=3, ncol=4, byrow=TRUE)
flipud(a)
fliplr(a)
Run the code above in your browser using DataLab