Operators: Operators

Description Usage Arguments Value Examples

Description

Some useful operators outside of the standard ones in R.

Usage

1
2
3
4
5
x %nin% y

x %NIN% y

x %IN% y

Arguments

x

a vector

y

a vector to match

Value

logical vecotor of items in x not in y

logical vecotor of items in x not in y, omits NAs

logical vecotor of items in x in y, omits NAs

Examples

1
2
3
4
5
6
7
8
9
y = c(3, 4, 5, NA)

# Not In -- and omits NA
y %nin% 3    # FALSE  TRUE  TRUE  TRUE
y %NIN% 3    # FALSE  TRUE  TRUE    NA

# IN -- Omits NA
y %in% 3     # TRUE FALSE FALSE FALSE
y %IN% 3     # TRUE FALSE FALSE    NA

lin-jennifer/lin documentation built on Jan. 1, 2021, 8:21 a.m.