isOrdered | R Documentation |
Check if a vector is strictly increasing, strictly decreasing, not decreasing, or not increasing.
isOrdered(x, increasing = TRUE, strictly = TRUE)
x |
A numeric vector. |
increasing |
Test for increasing ( |
strictly |
When |
Designed for internal use with xts, this provides highly optimized tests for ordering.
A logical scalar indicating whether or not x
is ordered.
Jeffrey A. Ryan
is.unsorted()
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.