\Header{na.fail}{Handle Missing Values in Objects}
\methalias{na.fail.default}{na.fail}
\alias{na.omit}{na.fail}
\methalias{na.omit.data.frame}{na.fail}
\methalias{na.omit.default}{na.fail}
\keyword{NA}{na.fail}
\begin{Description}\relax
These generic functions are useful for dealing with \code{\Link{NA}}s
in e.g., data frames.
\code{na.fail} returns the object if it does not contain any
missing values, and signals an error otherwise.
\code{na.omit} returns the object with incomplete cases removed.\end{Description}
\begin{Usage}
\begin{verbatim}
na.fail(object)
na.omit(object)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] an \R{} object, typically a data frame
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
At present these will handle vectors, matrices and data frames
comprising vectors and matrices (only).

If \code{na.omit} removes cases, the row numbers of the cases form the
\code{"na.action"} attribute of the result, of class \code{"omit"}.\end{Details}
\begin{SeeAlso}\relax
\code{\Link{na.action}}, \code{\Link{options}(na.action=..)} for setting ``NA
actions'', and \code{\Link{lm}} and \code{\Link{glm}} for functions
using these.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
DF <- data.frame(x = c(1, 2, 3), y = c(0, 10, NA))
na.omit(DF)
m <- as.matrix(DF)
na.omit(m)
na.fail(DF)#> Error: missing values in ..

options("na.action")
\end{ExampleCode}
\end{Examples}

