[Rd] Possible bug in read.fwf (PR#7350)
mase at is.titech.ac.jp
mase at is.titech.ac.jp
Mon Nov 8 08:05:18 CET 2004
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
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.
More information about the R-devel
mailing list