This returns TRUE
if values are not in a list. It's the opposite
of %in%
. This is particularly good when subsetting and you only want
to remove a few things (like diphthongs). You can remove those rather than
specifying all monophthongs you want to keep.
x %ni% y
A vector, presumably a subset of "y"
A vector
A list of logicals indicating whether the objects in x
are not
contained in y
.
Note that what this function does can easily be accomplished with !x %in% y
,
but I like the "not in" aspect. Probably a holdover from my Perl days...
You can also define this function as `%ni%` <- Negate(`%in%`)
but
when looking through the documentation on %in%, I found that it might be
better to modify the formal definition there instead.
Credit to this Stack Overflow question for showing how to get this to work in an R package.