match_ext {fuj} | R Documentation |
Value matching - Extensions
Description
Non matching alternatives and supplementary functions.
Usage
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)
Arguments
x |
vector or |
table |
vector or |
Details
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.
Value
-
%out%
: Alogical
vector of equal length ofx
,table
-
%wo%
,%wi%
: A vector of values ofx
-
any_match()
,no_match()
:TRUE
orFALSE
-
is_in()
: seebase::%in%()
Examples
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
[Package fuj version 0.2.1 Index]