[Rd] read.table with fill = TRUE

Gabor Grothendieck ggrothendieck at gmail.com
Mon Dec 22 14:06:33 CET 2008


There seems to be a problem with read.table
when fill = TRUE in this case.  In the example
below, note that:
- there should be 4 columns, not 3
- some rows like row 6 are cut off at the end
- others like row 7 seem completely wrong

> Lines <- "x 1 b
+ x 1 a
+ x 2 b
+ x 2 a
+ x 2
+ y 1 a 1
+ y 10 a 2
+ y 10 a 10
+ y 10 a 1
+ y 2
+ var 10 a 2
+ var 2
+ y 10"
>
> read.table(textConnection(Lines), fill = TRUE)
    V1 V2 V3
1    x  1  b
2    x  1  a
3    x  2  b
4    x  2  a
5    x  2
6    y  1  a
7    1 NA
8    y 10  a
9    2 NA
10   y 10  a
11  10 NA
12   y 10  a
13   1 NA
14   y  2
15 var 10  a
16   2 NA
17 var  2
18   y 10
> R.version.string
[1] "R version 2.8.1 RC (2008-12-17 r47235)"



More information about the R-devel mailing list