There are two bugs, due to problems in this change (a version of which is in NEWS).
r30192 2004-07-08 04:05:38 +0100 (Thu, 08 Jul 2004) multiline records, skipped columns in read.fwf. Added read.fortran for fixed format specifications like 3F4.2. 1) If left with 0 lines to read, read.fwf loops away. 2) 'skip' is passed on to read.table, but the skipped lines have been removed. Fixed for 2.0.1. On Mon, 8 Nov 2004 [EMAIL PROTECTED] wrote: > Full_Name: Shigeru Mase > Version: R 1.9.1 and 2.0.0 > OS: Debian Linux > Submission from: (NULL) (219.35.150.115) > > > I tried to read the following text file "test.txt" with 5 lines using > read.fwf() function: > > # comment 1 > 1234567 # comment 2 > 1 234567 # comment 3 > 12345 67 # comment 4 > # comment 5 > > In R 1.9.1, I got the following result (since I have R 2.0.0 installed now > I cannot reproduce it now but, at least, my former record says so): > > > (x <- read.fwf("test.txt", width=c(2,2,3), skip=1, n=4)) > V1 V2 V3 > 1 12 34 567 > 2 1 23 456 > 3 12 34 5 > > But, in R 2.0.0, the above command seems to run into endless loop, giving no > response. On the other hand, > > > (x <- read.fwf("test.txt", width=c(2,2,3), skip=1)) > V1 V2 V3 > 1 1 23 456 # skipped first 2 lines > 2 12 34 5 # skipped the last comment line > > By the way, the following gave the intended result, but skip the last > comment line: > > > (x <- read.fwf("test.txt", width=c(2,2,3), skip=0)) > V1 V2 V3 > 1 12 34 567 > 2 1 23 456 > 3 12 34 5 That's correct: comment lines are skipped, and that is what 1.9.1 did. > I have been puzzled and, seemingly, I could not find particular indications > of relevent changes in the help document. I searched relevent bug reports on > this site but seems there are none. I got the same behaviour report from a > user > of R 2.0.0 under MS Windows XP. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-devel