str_detect_approx: Approximate string matching, stringr style

View source: R/str_approx.R

str_detect_approxR Documentation

Approximate string matching, stringr style

Description

Perform approximate string detection while using familiar stringr syntax. str_detect_approx() is a wrapper around base R agrepl(). str_which_approx() is a wrapper around base R agrep(). str_subset_approx() is a wrapper around string[str_detect_approx(string, pattern)].

Usage

str_detect_approx(string, pattern, ...)

str_which_approx(string, pattern, ...)

str_subset_approx(string, pattern, ...)

Arguments

string

Input vector. Either a character vector, or something coearcible to one.

pattern

Pattern to look for.

...

see the documentation for agrep() for other arguments passed on to agrep() or agrepl()

Value

For str_detect_approx(), a logical vector. For str_which_approx() and str_subset_approx(), a character vector

See Also

agrep()

Examples

friends <- c("Jon", "Ron", "Jack", "Mac", "jan")
str_detect_approx(friends, "Jon")
str_detect_approx(friends, "Jon", ignore.case = TRUE)

chris-s-friedman/Friedman documentation built on Feb. 12, 2023, 8:02 p.m.