Closed PaulMelloy closed 4 years ago
I've never tried or run into this, but you're not alone: http://www.cookbook-r.com/Manipulating_data/Comparing_vectors_or_factors_with_NA/
Wow,
The 4 line function in the example you shared is way more efficient than my 27 line function.
Although that example I think can't handle a logical test if length(x) = 1
and length(y) > 1
. which mine can.
Nope their function operates the same as mine. I will replace mine with their and add error for vectors which lengths don't match
Throwing a question out there, I am probably missing a rookie error here is there a way in R to specify how NAs are tested when asking if
x == y
? ie if I wantNA == NA
to returnTRUE
is there a base function for that?I wrote a function
same()
to handle them how I want the to be handled, but surely this is a problem others have had to? Cheers