descending: Reverse a sorting function

Description Usage Arguments Value Examples

View source: R/descending.R

Description

Transform a function (typically used in sort_by), so that its ouput can be sorted in descending order.

Usage

1

Arguments

f

a function to modify.

Value

A function returning a numeric vector which, if passed to order, will be used to sort some data.

Examples

1
2
3
4
5
desc_abs <- descending(abs)

x <- -2:1
order(abs(x))
order(desc_abs(x))

funprog documentation built on Jan. 13, 2021, 11:52 a.m.