[R] Probelm with read.table

Arnaud_Amsellem@ssga.com Arnaud_Amsellem at ssga.com
Thu Dec 11 11:31:15 CET 2003


Hi All,

I have the following text file (mytextfile.txt)

738307      527178      714456      557955
#N/A  17.42 6.22  4.73
#N/A  17.3  6.23  4.75
#N/A  17.29 6.17  4.7
#N/A  17.07 6.12  4.6
#N/A  17.27 6.19  4.7
#N/A  17.72 6.4   4.78
#N/A  17.12 6.19  4.75
#N/A  17.07 6.15  4.65
#N/A  17.03 6.07  4.64
#N/A  17.38 6.13  4.7
#N/A  17.38 6.13  4.7
#N/A  17.38 6.13  4.7
#N/A  17.38 6.13  4.7
#N/A  17.34 6.28  4.7
10    17.57 6.33  4.75
11    17.57 6.33  4.75
12    17.57 6.33  4.75
13    17.39 6.25  4.87
14    17.15 6.33  5.06
15    17.05 6.21  5
16    16.87 6.14  5.15
17    16.72 6.27  5.23

I use the following command:
mydf <- read.table(file="mytextfile.txt", header = T, sep="\t",na.strings="
#NA")

When the above command is applied I have only 8 lines in mydf. I tried many
options but nothing seems to get me the entire file. If the #NA are not in
the first column it seems to work fine i.e I get  22 lines in mydf.
Anyone would know a way of getting the entire file even if #NA are in the
first column?

I use R 1.8.0 on Windows 2000

Any help appreciated

Arno




More information about the R-help mailing list