Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

isOrdered

Check If A Vector Is Ordered


Description

Performs check to determine if a vector is strictly increasing, strictly decreasing, not decreasing, or not increasing.

Usage

isOrdered(x, increasing = TRUE, strictly = TRUE)

Arguments

x

a numeric vector

increasing

test for increasing/decreasing values

strictly

are duplicates OK

Details

Designed for internal use with xts, this provides highly optimized tests for ordering.

Value

Logical

Author(s)

Jeffrey A. Ryan

See Also

Examples

# strictly increasing
isOrdered(1:10, increasing=TRUE)
isOrdered(1:10, increasing=FALSE)
isOrdered(c(1,1:10), increasing=TRUE)
isOrdered(c(1,1:10), increasing=TRUE, strictly=FALSE)

# decreasing
isOrdered(10:1, increasing=TRUE)
isOrdered(10:1, increasing=FALSE)

xts

eXtensible Time Series

v0.12.1
GPL (>= 2)
Authors
Jeffrey A. Ryan [aut, cph], Joshua M. Ulrich [cre, aut], Ross Bennett [ctb], Corwin Joy [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.