str_suggest_vec: Obtain string suggestions

View source: R/string-handling.R

str_suggest_vecR Documentation

Obtain string suggestions

Description

Compares input string against a pool of options and returns the values of the pool that are similar to the input string.

Usage

str_suggest_vec(string, pool, max.dist = 1, n.try = 0, n.top = 5)

str_suggest_list(string, pool, max.dist = 1, n.try = 0, n.top = 5)

Arguments

string

Input string. str_suggest_vec() takes a single character value of length 1. str_suggest_list() takes a character vector of arbitrary length.

pool

Character vector that contains all valid options.

max.dist

Numeric value. The maximum distance a string of the pool may have to be included in the suggestions.

n.try

Numeric value. The number of times the search for suggestions is repeated with max.dist+1. Defaults to 0.

n.top

Numeric value. The n best suggestions in terms of string distance to input string that are returned.

out.fail

The output value if no suggestions can be made.

Value

str_suggest_vec() returns a character vector of suggestions. Is of length 0 if no suggestions can be made. str_suggest_list() returns a named list of length equal to length of string. Each slot carries suggestions of one element of the input for string.


kueckelj/confuns documentation built on June 28, 2024, 9:19 a.m.