grapes-out-grapes: Additional value matching

Description Usage Arguments Examples

Description

Non matching alternatives and supplementary functions. Contrast with [base::match()], [base::intersect()], and [base::'

Usage

1
2
3
4
5
6
7
x %out% table

x %wo% table

x %wi% table

no_match(x, table)

Arguments

x

vector or NULL: the values to be matched. Long vectors are supported.

table

vector or NULL: the values to be matched against. Long vectors are not supported.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
1:10 %in% c(1,3,5,9)
1:10 %out% c(1,3,5,9)

# intersect() and setdiff() are similiar but don't keep duplicates
x <- c(1:6, 7:2)
y <- c(3, 7, 12)

x %wo% y      # --> keeps duplicated
setdiff(x, y) # --> unique values

x %wi% y        # --> keeps duplicated
intersect(x, y) # --> unique values

jmbarbone/dirtyr documentation built on Sept. 23, 2020, 4:05 a.m.