gin: A reimagination of '%in%' for partial string matching

%gin%R Documentation

A reimagination of %in% for partial string matching

Description

%gin% is a reimagination of %in% using grepl() for partial string matching.

Usage

pattern %gin% x

Arguments

pattern

Character string to be matched.

x

R object to be matched against. The object must be a character vector or an object coercible by as.character() to a character vector.

References

%gin% was first written for @ivelasq's r-data-recipes GitHub repository.

Examples

# %in% evaluates to FALSE because it looks for full string matches
"t" %in% "tonic"

# %gin% evaluates to TRUE
"t" %gin% "tonic"

# %gin% can be used with tab()
tab("Toyota" %gin% rownames(mtcars))


gvelasq-r/tabr documentation built on April 15, 2024, 2:19 p.m.