\Header{type.convert}{Type Conversion on Character Variables}
\keyword{manip}{type.convert}
\begin{Description}\relax
Convert a character vector to logical, integer, numeric, complex or
factor as appropriate.
\end{Description}
\begin{Usage}
\begin{verbatim}
type.convert(x, na.strings = "NA", as.is = FALSE, dec = ".")
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] a character vector.
\item[\code{na.strings}] a vector of strings which are to be interpreted as
\code{\Link{NA}} values.  Blank fields are also considered to be
missing values.
\item[\code{as.is}] logical. See Details.
\item[\code{dec}] the character to be assumed for decimal points.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This is principally a helper function for \code{\Link{read.table}}.
Given a character vector, it attempts to convert it to logical,
integer, numeric or complex, and failing that converts it to factor
unless \code{as.is = TRUE}.  The first type that can accept all the
non-missing values is chosen.

Vectors which are entirely missing values are converted to logical,
since \code{NA} is primarily logical.
\end{Details}
\begin{Value}
A vector of the selected class, or a factor.
\end{Value}
\begin{SeeAlso}\relax
\code{\Link{read.table}}
\end{SeeAlso}

