descending {funprog} | R Documentation |
Transform a function (typically used in sort_by
), so that its
ouput can be sorted in descending order.
descending(f)
f |
a function to modify. |
A function returning a numeric vector which, if passed to
order
, will be used to sort some data.
desc_abs <- descending(abs)
x <- -2:1
order(abs(x))
order(desc_abs(x))