

   SSeelleecctt OOnnee ooff aa LLiisstt ooff AAlltteerrnnaattiivveess

        switch(EXPR, ...)

   AArrgguummeennttss::

       EXPR: an expression that evaluates to a number or a
             character string

        ...: the list of alternatives, given explicitly

   DDeessccrriippttiioonn::

        `switch' evaluates `EXPR'.  If the value is an integer
        between 1 and `nargs()-1' then the corresponding ele-
        ment of `...' is evaluated and the result returned.  If
        `EXPR' returns a character string then that string is
        used to match the names of the elements in `...'.  If
        there is an exact match then that element is evaluated
        and the result returned.

   EExxaammpplleess::

        centre <- function(x, type) {
        switch(type,
               mean = mean(x),
               median = median(x),
               trimmed = mean(x, trim = .1))
        }
        x <- rcauchy(10)
        centre(x, "mean")
        centre(x, "median")
        centre(x, "trimmed")

