%nin% {broman}R Documentation

Value matching

Description

%in% returns logical vector indicating values that do not have a match. ⁠%win%⁠ returns a vector of the values that have a match. ⁠%wnin%⁠ returns a vector of the values that do not have a match.

Usage

x %nin% table

x %win% table

x %wnin% table

Arguments

x

Vector of values to be matched.

table

Vector of values to be matched against.

Value

⁠%nin%⁠ returns a logical vector of the same length of x, indicating which values are not in table.

⁠%win%⁠ returns a sub-vector of x with the values that were found in table.

⁠%wnin%⁠ returns a sub-vector of x with the values that were not found in table.

See Also

base::match()

Examples

vals <- c("a", "xa", "b")
vals %nin% letters
vals %win% letters
vals %wnin% letters

[Package broman version 0.80 Index]