
Last chance! 50% off unlimited learning
Sale ends in
Rev
provides a reversed version of its argument.
It wraps the base function rev
and provides an additional method for matrices and higher dimensional tables, such as to reverse the order of rows and columns.
Rev(x, ...)# S3 method for matrix
Rev(x, margin, …)
# S3 method for table
Rev(x, margin, …)
# S3 method for data.frame
Rev(x, margin, …)
a vector, a matrix or a higher dimensional table to be reversed.
vector of dimensions which to be reversed (1 for rows, 2 for columns, etc.).
the dots are passed to the matrix, resp. table interface.
# NOT RUN {
tab <- matrix( c( 1, 11, 111,
2, 22, 222,
3, 33, 333), byrow=TRUE, nrow=3)
Rev(tab, margin=1)
Rev(tab, margin=2)
# reverse both dimensions
Rev(tab, margin=c(1,2))
# }
Run the code above in your browser using DataLab