Learn R Programming

Zelig (version 4.2-1)

find.match: Find a Partial or Exact Match from a Vector of Strings Searches a vector of character-string, and returns the best match.

Description

Find a Partial or Exact Match from a Vector of Strings Searches a vector of character-string, and returns the best match.

Usage

find.match(needle, haystack, fail = NA)

Arguments

needle
a character-string to search for in the
haystack
a vector of character-strings
fail
the value to return in case no match is found. Defaults to NA

Value

  • the best-matched string or NA

Details

``find.match'' attempts to use several common matching functions in an order that sequentially prefers less strict matching, until a suitable match is found. If none is found, then return the value of the ``fail'' parameter (defaults to NA). The functions used for matching are: ``match'', ``charmatch'', and finally ``grep''.