Comparison Operators

DESCRIPTION:
Returns a vector of logicals which is the result of the comparison applied to each element of the input vectors.

USAGE:
e1 op e2

op:
one of >, <, >=, <=, == or !=.

REQUIRED ARGUMENTS:
e1, e2:
numeric, character, or complex objects. Missing values (NAs) are allowed.

VALUE:
logical vector with FALSE or TRUE in each element according to the truth of the element-wise comparison of the operands.

The comparison operators are:

OPERATOR MEANING > greater than < less than >= greater than or equal to <= less than or equal to == equal to != not equal to


DETAILS:
An NA element of e1 or e2 results in an NA element of the answer.

These are members of the Ops group of generic functions.

For complex data op orders first on the real part, then on the imaginary part if necessary. For character data, ordering is by the ASCII character set.

See section 5.6 of Becker, Chambers and Wilks for the rules for dealing with operands with attributes.


NOTE:
To test for missing values use is.na.

WARNING:
You need to leave a space between a "<" operator and a negative number because "<-" is always interpreted as the assignment operator. This is a very unusual case, spaces generally make no difference.

CLASSES:
This function will be used as the default method for classes that do not inherit a specifc method for the function or for the Ops group of functions. The result will retain the class and the attributes. If this behavior is not appropriate, the designer of the class should provide a method for the function or for the Ops group.

SEE ALSO:
Logic , match , is.na , sign .

EXAMPLES:
a > b      # true when a greater than b

x[x > 100] # all x values larger than 100

state == "Wyoming"