Test if an Object is Not Sorted
Test if an object is not sorted (in increasing order), without the cost of sorting it.
is.unsorted(x, na.rm = FALSE, strictly = FALSE)
- an R object with a class or a numeric, complex, character or logical vector.
- logical. Should missing values be removed before checking?
- logical indicating if the check should be for strictly increasing values.
A length-one logical value. All objects of length 0 or 1 are sorted:
the result will be
NAfor objects of length 2 or more except for atomic vectors and objects with a class (where the
>method is used to compare
This function is designed for objects with one-dimensional indices, as described above. Data frames, matrices and other arrays may give surprising results.