is.unsorted

0th

Percentile

Test if an Object is Not Sorted

Test if an object is not sorted (in increasing order), without the cost of sorting it.

Keywords
univar
Usage
is.unsorted(x, na.rm = FALSE, strictly = FALSE)
Arguments
x
an R object with a class or a numeric, complex, character or logical vector.
na.rm
logical. Should missing values be removed before checking?
strictly
logical indicating if the check should be for strictly increasing values.
Value

A length-one logical value. All objects of length 0 or 1 are sorted: the result will be NA for objects of length 2 or more except for atomic vectors and objects with a class (where the >= or > method is used to compare x[i] with x[i-1] for i in 2:length(x)).

Note

This function is designed for objects with one-dimensional indices, as described above. Data frames, matrices and other arrays may give surprising results.

See Also

sort, order.

Aliases
  • is.unsorted
Documentation reproduced from package base, version 3.0.3, License: Part of R 3.0.3

Community examples

Looks like there are no examples yet.