notin: Find non-matching values

Description Usage Arguments Value Examples

Description

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

Usage

1
x %notin% y

Arguments

x

vector or NULL: values to be compared.

y

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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/jutebag documentation built on May 12, 2019, 4:39 a.m.