| %ni% | R Documentation |
"%ni%" is a convenience shortcut for the negation of the match function (i.e. the %in%" operator).
x %ni% y
x |
the values to be negatively matched. |
y |
the values to be negatively matched against. |
A logical vector of the same length as x which is FALSE for matching values of y and TRUE for non-matching values of y.
Craig P. Hutton, Craig.Hutton@gov.bc.ca
match, Negate
c(1:100) %ni% c(2, 3, 5, 10, 78:91)
#subset data to extract rows with matching values using "%in%"
subset(pdata, g %in% c("a", "e"))
#subset data to extract rows with non-matching values using "%ni%"
subset(pdata, g %ni% c("a", "e"))
#equivalent to subset function for tidyverse users
dplyr::filter(pdata, g %ni% c("a", "e"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.