Rev 45778 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File src/library/base/man/char.expand.Rd% Part of the R package, http://www.R-project.org% Copyright 1995-2008 R Core Development Team% Distributed under GPL 2 or later\name{char.expand}\alias{char.expand}\title{Expand a String with Respect to a Target Table}\usage{char.expand(input, target, nomatch = stop("no match"))}\description{Seeks a unique match of its first argument among theelements of its second. If successful, it returns this element;otherwise, it performs an action specified by the third argument.}\arguments{\item{input}{a character string to be expanded.}\item{target}{a character vector with the values to be matchedagainst.}\item{nomatch}{an \R expression to be evaluated in case expansion wasnot possible.}}\details{This function is particularly useful when abbreviations are allowed infunction arguments, and need to be uniquely expanded with respect to atarget table of possible values.}\value{A length-one character vector, one of the elements of \code{target}(unless \code{nomatch} is changed to be a non-error, when it can be azero-length character string).}\seealso{\code{\link{charmatch}} and \code{\link{pmatch}} for performingpartial string matching.}\examples{locPars <- c("mean", "median", "mode")char.expand("me", locPars, warning("Could not expand!"))char.expand("mo", locPars)}\keyword{character}