\HeaderA{NA}{Not Available / ``Missing'' Values}{NA}
\aliasA{is.na}{NA}{is.na}
\methaliasA{is.na.data.frame}{NA}{is.na.data.frame}
\aliasA{is.na<\Rdash}{NA}{is.na<.Rdash.}
\methaliasA{is.na<\Rdash.default}{NA}{is.na<.Rdash..default}
\keyword{NA}{NA}
\keyword{logic}{NA}
\keyword{manip}{NA}
\begin{Description}\relax
\code{NA} is a logical constant of length 1 which contains a missing
value indicator.  \code{NA} can be freely coerced to any other vector
type except raw.

The generic function \code{is.na} indicates which elements are missing.

The generic function \code{is.na<-} sets elements to \code{NA}.
\end{Description}
\begin{Usage}
\begin{verbatim}
NA
is.na(x)
## S3 method for class 'data.frame':
is.na(x)

is.na(x) <- value
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] an \R{} object to be tested.
\item[\code{value}] a suitable index vector for use with \code{x}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The \code{NA} of character type is distinct from the
string \code{"NA"}.  Programmers who need to specify an explicit
string \code{NA} should use \code{as.character(NA)} rather than
\code{"NA"}, or set elements to \code{NA} using \code{is.na<-}.

\code{is.na(x)} works elementwise when \code{x} is a
\code{\LinkA{list}{list}}.  It is generic: you can write methods to handle
specific classes of objects, see \LinkA{InternalMethods}{InternalMethods}.

Function \code{is.na<-} may provide a safer way to set missingness.
It behaves differently for factors, for example.
\end{Details}
\begin{Value}
The default method for \code{is.na} returns a logical vector of the same
\dQuote{form} as its argument \code{x}, containing \code{TRUE} for those
elements marked \code{NA} or \code{\LinkA{NaN}{NaN}} (!) and \code{FALSE}
otherwise.  \code{dim}, \code{dimnames} and \code{names} attributes
are preserved.

The method \code{is.na.data.frame} returns a logical matrix with the
same dimensions as the data frame, and with dimnames taken from the
row and column names of the data frame.
\end{Value}
\begin{References}\relax
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.
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{NaN}{NaN}}, \code{\LinkA{is.nan}{is.nan}}, etc.,
and the utility function \code{\LinkA{complete.cases}{complete.cases}}.

\code{\LinkA{na.action}{na.action}}, \code{\LinkA{na.omit}{na.omit}}, \code{\LinkA{na.fail}{na.fail}}
on how methods can be tuned to deal with missing values.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
is.na(c(1, NA))        #> FALSE  TRUE
is.na(paste(c(1, NA))) #> FALSE FALSE

(xx <- c(0:4))
is.na(xx) <- c(2, 4)
xx                     #> 0 NA  2 NA  4
\end{ExampleCode}
\end{Examples}

