Learn R Programming

rje (version 1.4)

greaterThan: Comparing numerical values

Description

Just a wrapper for '

Usage

greaterThan(x, y)

Arguments

x
A numeric vector.
y
A numeric vector.

Value

  • An integer 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.

See Also

`<`< code=""> for traditional Boolean operator.

Examples

Run this code
greaterThan(4,6)

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

Run the code above in your browser using DataLab