Check if a Factor is an Ordered Factor in R Programming – is.ordered() Function Last Updated : 08 Nov, 2021 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 Like Article Suggest improvement Next Checking if the Object is a Factor in R Programming - is.factor() Function Share your thoughts in the comments Add Your Comment Please Login to comment...