Skip to contents

Determine if an element is not present inside of a set. In particular, this function checks to see if x is not in table.

Usage

x %notin% table

Arguments

x

vector or NULL: the values to be matched. Long vectors are supported.

table

vector or NULL: the values to be matched against. Long vectors are not supported.

Value

A logical vector of TRUE or FALSE that indicates if a match was not found for each element of x.

Details

This operator is a modified version of the %in% function.

See also

Examples

# Returns TRUE as 2 is not found in the vector c(3, 4)
2 %notin% c(3, 4)
#> [1] TRUE

# Returns FALSE as 2 is found in the vector c(1, 2)
2 %notin% c(1, 2)
#> [1] FALSE

# Vectorized variant that contains FALSE and TRUE
c(1, 2) %notin% c(2, 3)
#> [1]  TRUE FALSE