![]() |
VOOZH | about |
is.unsorted() function in R Language is used to check if an object is sorted or not. It returns False if the object is sorted otherwise True.
Syntax: is.unsorted(x) Parameters: x: ObjectExample 1: Output:
[1] FALSE [1] TRUEHere, the output is FALSE for vector because it is sorted and matrix is unsorted, hence the function returns TRUE for matrix. Example 2: Output:
[1] 2 4 2 5 7 1 3 8 1 [1] TRUE [1] 1 1 2 2 3 4 5 7 8 [1] FALSE