Arguments

Value

position(x) <- value first forces its argument to be an ordered
factor and then assigns the value to the "position"
attribute of the ordered factor.
The result is assigned class "positioned" and returned.

position(x) returns the position values associated with
levels(x). If x is a positioned factor, then
the "position" attribute is returned.
If x is a factor, then the integers
1:length(levels(x)) are returned. For anything else,
as.numeric(x) is returned.

as.position(x) returns a numeric vector the length of the
original vector. If x inherits from "factor",
then the values in the vector are the values in
position(x) subscripted by the levels of the factor.
If x is numeric, then x itself is returned.

unpositioned(x) removes the "position" attribute and
removes the "positioned" value from the the class of
the object.