keep_if_not_in: Discard elements present in x and not contained in y

Description Usage Arguments Value See Also Examples

View source: R/set-misc.R

Description

Unlike setdiff, it does not remove duplicates in x and keeps its order.

Usage

1
2
3
keep_if_not_in(x, y)

x %if_not_in% y

Arguments

x

Source vector.

y

Destination vector (of the same mode as x).

Value

A filtered version of x.

See Also

keep_if_in

Examples

1
2
3
4
5
keep_if_not_in(1:5, 3:6)
# returns [1 2]

keep_if_not_in(c(4, 3, 4, 3, 1), 3:6)
# returns [1]

Nmisc documentation built on April 28, 2021, 5:10 p.m.