Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

grapes-nin-grapes

Value matching


Description

%nin% is the complement to %in%. It looks which values in x do not match (hence, are not in) values in y.

Usage

x %nin% y

Arguments

x

Vector with values to be matched.

y

Vector with values to be matched against.

Details

See 'Details' in match.

Value

A logical vector, indicating if a match was not located for each element of x, thus the values are TRUE or FALSE and never NA.

Examples

c("a", "B", "c") %in% letters
c("a", "B", "c") %nin% letters

c(1, 2, 3, 4) %in% c(3, 4, 5, 6)
c(1, 2, 3, 4) %nin% c(3, 4, 5, 6)

sjmisc

Data and Variable Transformation Functions

v2.8.6
GPL-3
Authors
Daniel Lüdecke [aut, cre] (<https://orcid.org/0000-0002-8895-3206>), Iago Giné-Vázquez [ctb], Alexander Bartel [ctb] (<https://orcid.org/0000-0002-1280-6138>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.