

   AArrgguummeenntt VVeerriiffiiccaattiioonn UUssiinngg PPaarrttiiaall MMaattcchhiinngg

        match.arg(arg)
        match.arg(arg, choices)

   AArrgguummeennttss::

        arg: a character string

    choices: a character vector of candidate values

   DDeessccrriippttiioonn::

        `match.arg' matches `arg' against a table of candidate
        values as specified by `choices'.  In the one-argument
        form `match.arg(arg)', the choices are obtained from a
        default setting for the formal argument `arg' of the
        function from which `match.arg' was called.

        Matching is done using `pmatch', so `arg' may be abbre-
        viated.

   VVaalluuee::

        The unabbreviated version of the unique partial match
        if there is one; otherwise, an error is signalled.

   SSeeee AAllssoo::

        `pmatch', `match.fun', `match.call'.

   EExxaammpplleess::

        ## Extends the example for `switch'
        center <- function(x, type = c("mean", "median", "trimmed")) {
          type <- match.arg(type)
          switch(type,
                 mean = mean(x),
                 median = median(x),
                 trimmed = mean(x, trim = .1))
        }
        x <- rcauchy(10)
        center(x, "t")       # Works
        center(x, "med")     # Works
        center(x, "m")       # Error

