codes(object)
If object does not inherit from "factor", then as.vector(object) is returned.
Users should not strip the class from a factor and expect correct results.
codes(ordered(c("cat", "dog", "frog", "dog")))
# returns c(1, 2, 3, 2)
temperature <- ordered(c(140, 140, 125, 125, 130, 130))
as.vector(temperature, "numeric")
# coerce to numeric, returns c(140, 140, 125, 125, 130, 130)