Skip to contents

The opposite of %in%.

Usage

x %notin% vector

Arguments

x

Numeric or character vector.

vector

Numeric or character vector.

Value

A vector of TRUE or FALSE.

See also

Examples

data = data.table(ID=1:10, X=sample(1:10, 10))
data
#>        ID     X
#>     <int> <int>
#>  1:     1     9
#>  2:     2     4
#>  3:     3     3
#>  4:     4     6
#>  5:     5     8
#>  6:     6     7
#>  7:     7     5
#>  8:     8     2
#>  9:     9     1
#> 10:    10    10
data[ID %notin% c(1, 3, 5, 7, 9)]
#>       ID     X
#>    <int> <int>
#> 1:     2     4
#> 2:     4     6
#> 3:     6     7
#> 4:     8     2
#> 5:    10    10