Ops Group Method for Factors and Ordered Factors

DESCRIPTION:

Group Method defining all arithmetic, comparison, and logical operators on factors.

USAGE:

e1 OP e2 
OP e1 

REQUIRED ARGUMENTS:

e1, e2
objects, at least one of which inherits from class "factor", for Ops.factor, or from "ordered", for Ops.ordered.

VALUE:

a logical vector, for the comparison operators.

DETAILS:

The method will fail for arithmetic or logical operators. Each argument of the relevant class is converted to a vector, and the relevant comparison applied to the result. In the case of factors, only equality/inequality comparisons are meaningful (the levels of a factor are unordered). For ordered factors, all comparisons are meaningful, and are applied to the levels attribute, using its implied ordering.
This is a group method for the functions of the Ops group, the basic operators for arithmetic, comparison, and logic. It succeeds only for comparison operators.

SEE ALSO:

.

EXAMPLES:

x <- 1:10 
y <- factor(c("top", "bottom", "middle", "top", "bottom", "middle", "top", 
"middle", "top", "bottom")) 
x == y      #This example works. 
x > y       #This example doesn't work.