Description Usage Arguments Value Examples
Using a negation of %in% operator in the standard format produces less readable code. More natural way of using negation in this context would be to prepend 'in' with standard negation symbol, '!', which then results in using shorter and more readable 'x %!in% y' instead of '!(x %in% y)'. However, since R does not allow using '!' in function names, we use a special keyword 'nin' instead of '!in'.
1 | x %nin% y
|
x |
A data structure whose elements will be checked whether they are also present in data structure |
y |
A data structure that will be checked whether elements from |
A logical vector of equal length as x
, with element(s) not being present in y
as TRUE. If x
was a matrix, then the output corresponds to x
converted to a vector.
1 2 3 4 5 6 7 8 9 10 | # create some numeric vectors
x <- 1:4
y <- 3:6
# standard form
results <- !(x %in% y)
# new abbreviated format
resultsNew <- x %nin% y
all(results == resultsNew)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.