compareNA | R Documentation |
NA
-aware comparison of two vectorsCopied from
http://www.cookbook-r.com/Manipulating_data/Comparing_vectors_or_factors_with_NA/.
This function returns TRUE
wherever elements are the same, including NA
's,
and FALSE
everywhere else.
compareNA(v1, v2)
v1 |
A vector |
v2 |
A vector |
A logical vector, indicating positions where two vectors are same or differ.
a <- c(NA, 1, 2, NA)
b <- c(1, NA, 2, NA)
compareNA(a, b)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.