Vectorized flexible equality comparison which considers NAs as a value. Returns TRUE if both values are NA, and FALSE when only one is NA. The standard == comparison returns NA in both of these cases and sometimes this is interpreted unexpectedly. Author: Bryce Chamberlain. Tech Review: Maria Gonzalez.
eq(x, y, do.nanull.equal = TRUE)
First vector/value for comparison.
Second vector/value for comparison.
Return TRUE if both inputs are NA or NULL (tested via easyr::nanull).
Boolean vector/value of comparisons.
# NOT RUN {
c(NA,'NA',1,2,'c') == c(NA,NA,1,2,'a') # regular equality check.
eq(c(NA,'NA',1,2,'c'),c(NA,NA,1,2,'a')) # check with eq.
# }
Run the code above in your browser using DataLab