grapes-ni-grapes: negative value matching

%ni%R Documentation

negative value matching

Description

"%ni%" is a convenience shortcut for the negation of the match function (i.e. the %in%" operator).

Usage

x %ni% y

Arguments

x

the values to be negatively matched.

y

the values to be negatively matched against.

Value

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.

Author(s)

Craig P. Hutton, Craig.Hutton@gov.bc.ca

See Also

match, Negate

Examples

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"))


bcgov/elucidate documentation built on Sept. 3, 2022, 7:16 p.m.