Re: [Rd] read.table() errors with tab as separator (PR#9061)

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Wed 05 Jul 2006 - 09:50:27 GMT

John.Maindonald@anu.edu.au writes:

> (1) read.table(), with sep="\t", identifies 13 our of 1400 records,
> in a file with 1400 records of 3 fields each, as having only 2 fields.
> This happens under version 2.3.1 for Windows as well as with
> R 2.3.1 for Mac OS X, and with R-devel under Mac OS X.
> [R version 2.4.0 Under development (unstable) (2006-07-03 r38478)]
>
> (2) Using read.table() with sep="\t", the first 1569 records only
> of a 1821 record file are input. The file has exactly two fields
> in each record, and the minimum length of the second field is
> 1 character. If however I extract lines 1561 to 1650 from the
> file (the file "short.txt" below), all 90 lines are input.

Notice that the single quote is a quote character in read.table (as opposed to read.delim, which uses only the double quote, to cater for TAB-separated files from Excel & friends).

> [1] "865\tlinear model (lm)! Cook's distance\t152"

                                   ^
                                 !!!!

(This reminds me that we probably should shift the default for comment.char too since it leads to similar issues, but it seems not to be the problem in this case.)

-- 
   O__  ---- Peter Dalgaard             ุster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)                  FAX: (+45) 35327907

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Wed Jul 05 19:53:25 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 05 Jul 2006 - 12:26:11 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.