isSorted

Syntax

isSorted(X, [ascending=true])

Arguments

X is a vector.

ascending is a Boolean indicating whether X is sorted in ascending order(true) or descending order(false). The default value is true.

Details

Check whether a vector is sorted or not.

Examples

$ x=NULL 1 2 3
$ isSorted(x);
1

$ t=table(9 7 5 3 as x, 1 5 2 4 as y)
$ t.x.isSorted(false);
1

$ t.y.isSorted();
0