[R] read.table
Uwe Ligges
ligges at statistik.uni-dortmund.de
Sat Feb 26 14:24:34 CET 2005
Tilo Blenk wrote:
> Maybe argument 'fill' of read.table is the solution.
>
> The default value is FALSE in read.table and, therefore, any line not
> having the same number of fields as the first line (not skipped) will
> make problems. If set to TRUE, as in read.delim and read.csv, lines with
> less number of fields get blank fields added at the end.
>
> If exporting tab delimited text files from Excel lines with empty fields
> at the end in the Excel file often have less fields than the header line
> in the text file. Reading them with read.delim fixes that.
>
> If the problem is more complicated you probably need to find the lines
> with count.fields and correct them manually.
>
> You can find them (actually the line number) with something like
>
> which(count.fields('data.txt') != count.fields('data.txt')[1])
>
> assuming that the first line has the correct number of fields.
>
> Tilo
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
Tilo,
is this an answer to a R-help question?
If so, I'd like to suggest to cite the original post and reply also to
the original poster who might not be a subscribed member of this list...
Uwe Ligges
More information about the R-help
mailing list