r - Finding strings not %in% other vector of strings -


this question has answer here:

if have vector of strings , want know match. it's simple matter of using %in%.

x <- c("red","blue","green") y <- c("yellow","blue","orange")  which(x %in% y) # literally, x in y. 

but opposite, find x not in y?

a neat way (that learnt @joran, iirc) is:

`%nin%` <- negate(`%in%`) which(x %nin% y) [1] 1 3     

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -