Learn R Programming

operator.tools (version 1.3.0)

NOT IN: Logical Operator: NOT IN

Description

A "NOT IN" operator that is cognitively simpler than the more verbose ! x %in% table

Usage

x %!in% table

Arguments

x
values to be matched
table
values to not be matched against

Value

  • Logical vector indicating if each element of x was found in y.

Details

Implemented as: function(x,y) ! x %in% y

See Also

match

Examples

Run this code
1:10 %!in% c(1,3,5,9)
  sstr <- c("c","ab","B","bba","c",NA,"@","bla","a","Ba","%")
  sstr[sstr %!in% c(letters, LETTERS)]

Run the code above in your browser using DataLab