descending {funprog}R Documentation

Reverse a sorting function

Description

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

Usage

descending(f)

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

desc_abs <- descending(abs)

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

[Package funprog version 0.3.0 Index]