%==% | R Documentation |
Replicates '==' behavior, but returns F instead of NA when making comparisons of <exists> == NA. NA == NA still returns missing when comparing equal length vectors.
Left and Right sides must be same length, or one of them length 1.
Equal length vectors will return vector of point-wise comparisons between the two
If left or right is length 1, it compares it to the entire other vector, returning a vector of logicals comparing to each place.
left %==% right
left |
Left side of operator |
right |
right side of operator |
vector of logicals
set.seed(3141)
colors = c("red","blue")
Col_Samp1 = sample(c(colors,NA), size = 10, replace = T, prob = c(.5,.2,.3))
Col_Samp2 = sample(c(colors,NA), size = 10, replace = T, prob = c(.5,.2,.3))
View(t(rbind(Col_Samp1,Col_Samp2,
Col_Samp1 == Col_Samp2,
Col_Samp1 %==% Col_Samp2)))
View(t(rbind(Col_Samp1,Col_Samp2,
'red' == Col_Samp1,
'red' %==% Col_Samp1)))
T == NA
T %==% NA
NA == NA
NA %==% NA
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.