
Last chance! 50% off unlimited learning
Sale ends in
rev
provides a reversed version of its argument. It is generic
function with a default method for vectors and one for
dendrogram
s. Note that this is no longer needed (nor efficient) for obtaining
vectors sorted into descending order, since that is now rather more
directly achievable by sort(x, decreasing = TRUE)
.
rev(x)
seq
, sort
.x <- c(1:5, 5:3)
## sort into descending order; first more efficiently:
stopifnot(sort(x, decreasing = TRUE) == rev(sort(x)))
stopifnot(rev(1:7) == 7:1) #- don't need 'rev' here
Run the code above in your browser using DataLab