[R] A weird observation from using read.table

Jun Ding dingjun_cn at yahoo.com
Sat Sep 22 18:11:29 CEST 2007


Hi Everyone, 

Recently I got puzzled by the function read.table,
even though I have used it for a long time. 

I have such a file (tmp.txt, 2 rows and 3 columns,
with a space among columns):

1 2'-PDE 4
2 3'-PDE 5

if I do:
a = read.table("tmp.txt", header = F, quote = "")
a
  V1     V2 V3
1  1 2'-PDE  4
2  2 3'-PDE  5

Everything is fine. 

However, if I do:
a = read.table("tmp.txt", header = F)
a
  V1     V2 V3
1  2 3'-PDE  5
2  1 2'-PDE  4
3  2 3'-PDE  5

I know it is related to the "quote" as the default
includes '. But how can it get one more row in the
file? Thank you very much for your help in advance!

Jun



More information about the R-help mailing list