is_sorted: Is a vector sorted?

View source: R/is_sorted.R

is_sortedR Documentation

Is a vector sorted?

Description

Is a vector sorted?

Usage

is_sorted(x, asc = NA)

isntSorted(x, asc = NA)

Arguments

x

An atomic vector.

asc

Single logical. If NA, the default, a vector is considered sorted if it is either sorted ascending or sorted descending; if FALSE, a vector is sorted only if sorted descending; if TRUE, a vector is sorted only if sorted ascending.

Value

is_sorted returns TRUE or FALSE

isntSorted returns 0 if sorted or the first position that proves the vector is not sorted


hutilscpp documentation built on Oct. 11, 2023, 9:06 a.m.