1% File src/library/base/man/sort.Rd
2% Part of the R package, https://www.R-project.org
3% Copyright 1995-2017 R Core Team
4% Distributed under GPL 2 or later
5
6\name{is.unsorted}
7\alias{is.unsorted}
8\title{Test if an Object is Not Sorted}
9\description{
10  Test if an object is not sorted (in increasing order), without the
11  cost of sorting it.
12}
13\usage{
14is.unsorted(x, na.rm = FALSE, strictly = FALSE)
15}
16\arguments{
17  \item{x}{an \R object with a class or a numeric, complex, character,
18    logical or raw vector.}
19  \item{na.rm}{logical.  Should missing values be removed before checking?}
20  \item{strictly}{logical indicating if the check should be for
21    \emph{strictly} increasing values.}
22}
23\details{
24  \code{is.unsorted} is generic: you can write methods to handle
25  specific classes of objects, see \link{InternalMethods}.
26}
27\value{
28  A length-one logical value.  All objects of length 0 or 1 are sorted.
29  Otherwise, the result will be \code{NA} except for atomic vectors and
30  objects with an S3 class (where the \code{>=} or \code{>} method is
31  used to compare \code{x[i]} with \code{x[i-1]} for \code{i} in
32  \code{2:length(x)}) or with an S4 class where you have to provide a
33  method for \code{\link{is.unsorted}()}.
34%% FIXME: rather want  '>' and '>=' methods for S4 classes be sufficient
35}
36\note{
37  This function is designed for objects with one-dimensional indices, as
38  described above.  Data frames, matrices and other arrays may give
39  surprising results.
40}
41\seealso{\code{\link{sort}}, \code{\link{order}}.}
42
43\keyword{univar}
44