ordered(x, levels=<<see below>>, labels=<<see below>>, exclude=NA) ordered(x) <- levels is.ordered(x) as.ordered(x)
is.ordered returns TRUE if x inherits from class "ordered", and FALSE otherwise.
as.ordered returns x if x inherits from class "ordered", and returns ordered(x) otherwise.
The assignment version of the function, "ordered<-" is generic. There is a method for data frames as well as a default method.
ratings <- ordered(ratings.text, c("Low","Med","High") ) # reverse the ordering ordered(ratings) <- c("High","Med","Low")temperature <- ordered(c(140, 140, 125, 125, 130, 130)) as.vector(temperature, "numeric") # coerce to numeric codes(temperature) # numeric vector of indices in to the levels