\Header{pmatch}{Partial String Matching}
\keyword{character}{pmatch}
\begin{Usage}
\begin{verbatim}
pmatch(x, table, nomatch = NA, duplicates.ok = FALSE)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\texttt{x}] the values to be matched.
\item[\texttt{table}] the values to be matched against.
\item[\texttt{nomatch}] the value returned at non-matching positions.
\item[\texttt{duplicates.ok}] should duplicate matches be allowed.
\end{ldescription}
\end{Arguments}
\begin{Description}
\texttt{pmatch} seeks matches for the elements of its first argument
among those of its second.
If there is a no match, then the value of \texttt{nomatch}
is returned and if there is a unique match then the index
of the matching value is returned.
If there are multiple matches the result depends
on the value of {duplicates.ok}.
If \texttt{duplicates.ok} is false multiple matches will result
in the value of \texttt{nomatch} being returned, and if it
is true, the index of the first matching value will be returned.\end{Description}
\begin{SeeAlso}
\texttt{\Link{match}}, \texttt{\Link{charmatch}} and
\texttt{\Link{match.arg}}, \texttt{\Link{match.fun}},
\texttt{\Link{match.call}}, for function argument matching etc.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
pmatch("", "")                             # returns NA
pmatch("m",   c("mean", "median", "mode")) # returns NA
pmatch("med", c("mean", "median", "mode")) # returns 2
\end{ExampleCode}
\end{Examples}

