allequal: Test if two objects have the same elements
Description
allequal tests if two objects have all the same
elements, including whether they have NAs in the same place.
Usage
allequal(x, y)
Arguments
x
first object to compare
y
second object to compare
Value
Returns TRUE if x and y exist and all elements are equal, FALSE if
some elements are unequal.
If there are NA values, returns TRUE if is.na(x) == is.na(y) and
all other elements are equal.
Returns FALSE if is.na(x) != is.na(y).
Retuns FALSE if x or y (but not both) is NULL.
Details
Unlike
all(x == y), allequal will return FALSE if either object is NULL. Does not
check class types, so allequal will return TRUE in some cases
where identical will return FALSE (e.g. if two objects are
identical when coerced to the same class). allequal always
retuns a logical value, so it can be used safely in if expressions.