I am trying to check if any particular value is in the data frame.
I know that an operator %in%should allow me to do this, but it does not work as I would expect when applied to the entire data frame:
A = data.frame(B=c(1,2,3,4), C=c(5,6,7,8))
1 %in% A
[1] FALSE
But if I applied this to a specific column, the value in it works as I expect:
1 %in% A$C
[1] TRUE
What is the correct way to check if any value is in the data frame?
source
share