如果你有一个字符串向量并且你想知道哪个匹配。使用 %in% 很简单。
x <- c("red","blue","green")
y <- c("yellow","blue","orange")
which(x %in% y) # Literally, which X are in Y.
但是相反的情况呢,你想在哪里找到哪些 X 不在 Y 中?
如果你有一个字符串向量并且你想知道哪个匹配。使用 %in% 很简单。
x <- c("red","blue","green")
y <- c("yellow","blue","orange")
which(x %in% y) # Literally, which X are in Y.
但是相反的情况呢,你想在哪里找到哪些 X 不在 Y 中?