| fuzzyMatches {HELP} | R Documentation |
Match and reinterpret a vector in terms of a second vector, essentially using the second vector as a key to interpret the first.
fuzzyMatches(x, y, ...)
x |
vector, the values to be matched. |
y |
vector, the values to be matched against. |
... |
Arguments to be passed to methods (see getSamples-methods):
strictx can reference values in y. If TRUE (default), only exact matches of values in x and y will be used. keepx (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. aliasnomatch for non-matching values in x. match.ally (default is "*"). Any occurence of match.all in x will be replaced by all values in y. nomatchstrict = FALSE, keep = TRUE, and alias = FALSE.na.rmx will cause an error and missing values in code{y} may cause unexpected behavior. ... |
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.
Returns a vector of unique values in x, that match values in y according to the parameters described above.
Reid F. Thompson (rthompso@aecom.yu.edu)
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)