\HeaderA{logical}{Logical Vectors}{logical}
\aliasA{as.logical}{logical}{as.logical}
\aliasA{F}{logical}{F}
\aliasA{FALSE}{logical}{FALSE}
\aliasA{is.logical}{logical}{is.logical}
\aliasA{T}{logical}{T}
\aliasA{TRUE}{logical}{TRUE}
\keyword{classes}{logical}
\keyword{logic}{logical}
\begin{Description}\relax
Create or test for objects of type \code{"logical"}, and the basic
logical constants.
\end{Description}
\begin{Usage}
\begin{verbatim}
TRUE
FALSE
T; F

logical(length = 0)
as.logical(x, ...)
is.logical(x)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{length}] desired length.
\item[\code{x}] object to be coerced or tested.
\item[\code{...}] further arguments passed to or from other methods.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\code{TRUE} and \code{FALSE} are \LinkA{reserved}{reserved} words denoting logical
constants in the \R{} language, whereas \code{T} and \code{F} are global
variables whose initial values set to these.  All four are
\code{logical(1)} vectors.
\end{Details}
\begin{Value}
\code{logical} creates a logical vector of the specified length.
Each element of the vector is equal to \code{FALSE}.

\code{as.logical} attempts to coerce its argument to be of logical
type.  For \code{\LinkA{factor}{factor}}s, this uses the \code{\LinkA{levels}{levels}}
(labels).  Like \code{\LinkA{as.vector}{as.vector}} it strips attributes including
names.

\code{is.logical} returns \code{TRUE} or \code{FALSE} depending on
whether its argument is of logical type or not.
\end{Value}
\begin{References}\relax
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
\emph{The New S Language}.
Wadsworth \& Brooks/Cole.
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{NA}{NA}}, the other logical constant.
\end{SeeAlso}

