Unordered analogue of base R's as.ordered. Will convert x to an unordered factor; unlike as.factor(), this will convert ordered factors to unordered factors.
as.unordered(x)
Arguments
x: Object to convert to unordered factor
Returns
x as an unordered factor
Examples
# Convert an ordered factor to unorderedas.unordered(gl(5,1,ordered =TRUE))# If level order is pre-specified differently from default alphabetical order# then the ordering will be retainedas.unordered(ordered(c("a","b","c"), levels = c("c","a","b")))# Otherwise the vector will be converted to an unordered factor with levels# in the default alphabetical orderas.unordered(c("c","a","b"))# Note that coercing integer values will sort the values to use as the levelsas.unordered(4:1)