Description Usage Arguments Value Author(s) References See Also Examples
If each successive value in a numeric vector is less-than-or-equal-to
the previous, or if each successive value is greater-than-or-equal-to
the previous, we understand the vector as a whole to be monotonic
.
The functions nondecreasing
and nonincreasing
give element-wise
diagnoses, showing positions at which the assertion holds (element 1 is
always TRUE). Use strict=TRUE
for strictly less-than or greater-than
logic.
1 2 3 4 5 6 | ## Default S3 method:
nondecreasing(x, strict=FALSE, ...)
## Default S3 method:
nonincreasing(x, strict=FALSE, ...)
## Default S3 method:
monotonic(x, strict=FALSE, ...)
|
x |
vector |
strict |
if FALSE, repeated values are tolerated. See examples. |
... |
ignored |
logical. A single valueFor monotonic
;
A vector (same length as x) nondecreasing
and nonincreasing
.
Tim Bergsma
http://metrumrg.googlecode.com
prev
1 2 3 4 5 | x <- c(1,2,2,3,4)
nondecreasing(x)
nonincreasing(x)
monotonic(x)
monotonic(x,strict=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.