Rev 49852 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File src/library/base/man/missing.Rd% Part of the R package, http://www.R-project.org% Copyright 1995-2009 R Core Development Team% Distributed under GPL 2 or later\name{missing}\alias{missing}\title{Does a Formal Argument have a Value?}\usage{missing(x)}\description{\code{missing} can be used to test whether a value was specifiedas an argument to a function.}\arguments{\item{x}{a formal argument.}}\details{\code{missing(x)} is only reliable if \code{x} has not been alteredsince entering the function: in particular it will \emph{always}be false after \code{x <- match.arg(x)}.The example shows how a plotting function can be written to work witheither a pair of vectors giving x and y coordinates of points to beplotted or a single vector giving y values to be plotted against theirindices.Currently \code{missing} can only be used in the immediate body ofthe function that defines the argument, not in the body of a nestedfunction or a \code{local} call. This may change in the future.This is a \link{primitive} function.}\references{Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)\emph{The New S Language}.Wadsworth & Brooks/Cole.Chambers, J. M. (1998)\emph{Programming with Data. A Guide to the S Language}.Springer.}\seealso{\code{\link{substitute}} for argument expression;\code{\link{NA}} for missing values in data.}\examples{myplot <- function(x,y) {if(missing(y)) {y <- xx <- 1:length(y)}plot(x,y)}}\keyword{programming}