notin: Find non-matching values

notinR Documentation

Find non-matching values

Description

Returns non-matching values for its left operand when compared to the right operand.

Usage

x %notin% y

Arguments

x

A vector or NULL: values to be compared.

y

A vector or NULL: values for which non-matches should be returned.

Value

A logical vector indicating if there is no match for its left operand.

Examples

foo <- letters[1:6]
foo[foo %notin% c("a", "c", "e")]
# => [1] "b" "d" "f"

lst <- list(a = 1, b = 2, c = 3, d = 4)
lst[names(lst) %notin% c("a", "c", "d")]
# =>
# $b
# [1] 2

NULL %notin% c(1, 2)
# => logical(0)

c("a", "b", "c") %notin% NULL
# => [1] TRUE TRUE TRUE


toniprice/jute documentation built on Jan. 11, 2023, 8:23 a.m.