Test if an Object is Sorted

Description

Test if an object is sorted, without the cost of sorting it. Wrapper to is.unsorted.

Usage

1
is.sorted(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.

See Also

is.unsorted

Examples

1
stopifnot( is.sorted(1, 2, 4) )

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.