| %ne% | R Documentation |
The goal of the %ne% operator is to return a TRUE
or FALSE value when any two objects are compared. The function is the
opposite of the equality operator. It returns a TRUE when the objects
are not equal.
This operator also allows comparing of data frames. It will return TRUE if any values in the data frames are not equal, and ignores differences in attributes.
x1 %ne% x2
x1 |
The first object to compare |
x2 |
The second object to compare |
A single TRUE or FALSE value depending on whether the objects are not equal.
Other operators:
%eq%(),
%ge%(),
%gt%(),
%le%(),
%lt%(),
%p%()
# Comparing of NULLs and NA
NULL %ne% NULL # FALSE
NULL %ne% NA # TRUE
NA %ne% NA # FALSE
1 %ne% NULL # TRUE
1 %ne% NA # TRUE
# Comparing of atomic values
1 %ne% 1 # FALSE
"one" %ne% "one" # FALSE
1 %ne% "one" # TRUE
1 %ne% Sys.Date() # TRUE
# Comparing of vectors
v1 <- c("A", "B", "C")
v2 <- c("A", "B", "D")
v1 %ne% v1 # FALSE
v1 %ne% v2 # TRUE
# Comparing of data frames
mtcars %ne% mtcars # FALSE
mtcars %ne% iris # TRUE
iris %ne% iris[1:50,] # TRUE
# Mixing it up
mtcars %ne% NULL # TRUE
v1 %ne% NA # TRUE
1 %ne% v1 # TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.