greaterThan {rje}R Documentation

Comparing numerical values

Description

Just a wrapper for comparing numerical values, for use with quicksort.

Usage

greaterThan(x, y)

Arguments

x

A numeric vector.

y

A numeric vector.

Details

Just returns -1 if x is less than y, 1 if x is greater, and 0 if they are equal (according to ==). The vectors wrap as usual if they are of different lengths.

Value

An integer vector.

Author(s)

Robin Evans

See Also

`<` for traditional Boolean operator.

Examples


greaterThan(4,6)

# Use in sorting algorithm.
quickSort(c(5,2,9,7,6), f=greaterThan)
order(c(5,2,9,7,6))


[Package rje version 1.12.1 Index]