rev {base} | R Documentation |
rev
provides a reversed version of its argument.
It can be used in combination with
sort
to obtain vectors sorted into descending order.
rev(x)
seq
, sort
.
x <- c(1:5,5:3)
# sort into descending order
rev(sort(x))
all(rev(1:7) == 7:1)#- don't need `rev' here