VOOZH about

URL: https://www.geeksforgeeks.org/r-language/check-if-an-object-is-sorted-or-not-in-r-programming-is-unsorted-function/

⇱ Check if an Object is sorted or not in R Programming - is.unsorted() Function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Check if an Object is sorted or not in R Programming - is.unsorted() Function

Last Updated : 15 Jul, 2025
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: Object
Example 1: Output:
[1] FALSE
[1] TRUE
Here, 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
Comment

Explore