count.fields {utils} | R Documentation |
count.fields
counts the number of fields, as separated by
sep
, in each of the lines of file
read.
count.fields(file, sep = "", quote = "\"'", skip = 0,
blank.lines.skip = TRUE, comment.char = "#")
file |
a character string naming an ASCII data file, or a
|
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. |
quote |
the set of quoting characters |
skip |
the number of lines of the data file to skip before beginning to read data. |
blank.lines.skip |
logical: if |
comment.char |
character: a character vector of length one containing a single character or an empty string. |
This used to be used by read.table
and can still be
useful in discovering problems in reading a file by that function.
For the handling of comments, see scan
.
A vector with the numbers of fields found.
read.table
cat("NAME", "1:John", "2:Paul", file = "foo", sep = "\n")
count.fields("foo", sep = ":")
unlink("foo")