\Header{count.fields}{Count the Number of Fields per Line}
\keyword{file}{count.fields}
\begin{Description}\relax
\code{count.fields} counts the number of fields, as separated by
\code{sep}, in each of the lines of \code{file} read.  It is used by
\code{\Link{read.table}};  a user will typically have no need for it.\end{Description}
\begin{Usage}
\begin{verbatim}
count.fields(file, sep = "", quote = "\"'", skip = 0)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{file}] a character string naming an ASCII data file
\item[\code{sep}] the field separator character.  Values on each line of the
file are separated by this character.  By default, arbitrary amounts
of whitespace can separate fields.
\item[\code{quote}] the set of quoting characters
\item[\code{skip}] the number of lines of the data file to skip before
beginning to read data.
\end{ldescription}
\end{Arguments}
\begin{Value}
A vector with the numbers of fields found.\end{Value}
\begin{SeeAlso}\relax
\code{\Link{read.table}}\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
cat("NAME", "1:John", "2:Paul", file = "foo", sep = "\n")
count.fields("foo", sep = ":")
unlink("foo")
\end{ExampleCode}
\end{Examples}

