| match_ext | R Documentation |
Non matching alternatives and supplementary functions.
is_in(x, table)
is_out(x, table)
x %out% table
is_within(x, table)
x %wi% table
is_without(x, table)
x %wo% table
no_match(x, table)
any_match(x, table)
x |
vector or |
table |
vector or |
Contrast with base::match(), base::intersect(), and
base::%in%() The functions of %wi% and %wo% can be used in lieu of
base::intersect() and base::setdiff(). The primary difference is that
the base functions return only unique values, which may not be a desired
behavior.
%out%: A logical vector of equal length of x, table
%wo%, %wi%: A vector of values of x
any_match(), no_match(): TRUE or FALSE
is_in(): see base::%in%()
1:10 %in% c(1, 3, 5, 9)
1:10 %out% c(1, 3, 5, 9)
letters[1:5] %wo% letters[3:7]
letters[1:5] %wi% letters[3:7]
# base functions only return unique values
c(1:6, 7:2) %wo% c(3, 7, 12) # -> keeps duplicates
setdiff(c(1:6, 7:2), c(3, 7, 12)) # -> unique values
c(1:6, 7:2) %wi% c(3, 7, 12) # -> keeps duplicates
intersect(c(1:6, 7:2), c(3, 7, 12)) # -> unique values
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.