Check if a Factor is an Ordered Factor in R Programming – is.ordered() Function Improve Improve Like Article Like Save Share Report is.ordered() function in R Programming Language is used to check if the passed factor is an ordered factor. Syntax: is.ordered(factor) Parameters: factor: Factor to be checked is.ordered() Function in R Programming Example Example 1: Demonestration of R – is.ordered() Function R # Creating a vector x<-c("female", "male", "male", "female") # Converting vector into factor gender <- factor(x) # Using is.ordered() Function # to check if a factor is ordered is.ordered(gender) Output: [1] FALSE Example 2: R # creating vector size size = c("small", "large", "large", "small", "medium", "large", "medium", "medium") sizes <- ordered(c("small", "large", "large", "small", "medium")) # ordering the levels sizes <- ordered(sizes, levels = c("small", "medium", "large")) # Checking if the factor is ordered # using is.ordered() function is.ordered(sizes) Output: [1] TRUE Last Updated : 08 Nov, 2021 Like Article Save Article Previous Calculate the absolute value in R programming - abs() method Next Calculate cosine of a value in R Programming - cos() Function Share your thoughts in the comments Add Your Comment Please Login to comment...