fuzzyMatches {HELP} | R Documentation

## Fuzzy matching

### Description

Match and reinterpret a vector in terms of a second vector, essentially using the second vector as a key to interpret the first.

### Usage

    fuzzyMatches(x, y, ...)

### Arguments

`x` | vector, the values to be matched.
`y` | vector, the values to be matched against.
`...` | Arguments to be passed to methods (see `getSamples-methods`): strict logical indicating whether or not to allow restrict matching. If FALSE, numerical indices in `x` can reference values in `y`. If TRUE (default), only exact matches of values in `x` and `y` will be used. keep logical indicating whether or not to preserve non-matching values from `x` (when `strict = FALSE`). If TRUE (default), all values in `x` will be returned with those that match values in `y` replaced by the corresponding values in `y`. If FALSE, non-matching values will be removed. alias logical indicating whether or not to return aliased values (default is TRUE). If FALSE, numerical indices will be returned with a value of `nomatch` for non-matching values in `x`. match.all character value, specifying a special value to be interpreted as a match for ALL values in `y` (default is "*"). Any occurence of `match.all` in `x` will be replaced by all values in `y`. nomatch numerical, specifying a value for non-matching values in codex when `strict = FALSE`, `keep = TRUE`, and `alias = FALSE`. na.rm a logical value indicating whether NA values should be stripped before the computation proceeds (default is TRUE). If FALSE any missing values in `x` will cause an error and missing values in codey may cause unexpected behavior. \dots other arguments not handled at this time.

### Details

This function employs multiple stages of matching between two vectors. First, the values in `x` are matched against `y` to find any exact matches. Next, numerical values in `x` are used to retrieve the corresponding positions in `y`. All unmatched values may be retained or dropped (depending on the value of `keep`), and a list of unique values is returned. Note that a value of `match.all` in `x` will be interpreted as a match for ALL values in `y`, and therefore replaced with the contents of `y`.

### Value

Returns a vector of unique values in `x`, that match values in `y` according to the parameters described above.

### Author(s)

Reid F. Thompson (rthompso@aecom.yu.edu)

### See Also

`fuzzyMatches-methods`, `match`

### Examples

    a <- c(1, "four", "missing")
    b <- c("one", "two", "three", "four")
    fuzzyMatches(a, b)
    fuzzyMatches(a, b, strict=FALSE)
    fuzzyMatches(a, b, strict=FALSE, alias=FALSE)
    fuzzyMatches(a, b, strict=FALSE, keep=FALSE)

[Package HELP version 1.48.0 Index]