# Convert an ordered factor to unordered
as.unordered(gl(5,1,ordered = TRUE))
# If level order is pre-specified differently from default alphabetical order
# then the ordering will be retained
as.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 order
as.unordered(c("c", "a", "b"))
# Note that coercing integer values will sort the values to use as the levels
as.unordered(4:1)
Run the code above in your browser using DataLab