[R] read.table and missing values
rbeer at uni-goettingen.de
Tue Jun 19 18:25:45 CEST 2001
>You have set sep="\t", haven't you? The default separator is white space,
>and that will swallow two tabs. The following had tabs in originally,
>a b c
>1 2 3
> 8 9
>> read.table("foo.dat", header=T, sep="\t")
> a b c
>1 1 2 3
>2 4 NA 6
>3 NA 8 9
Cool! Thanks a lot! I had the same problem a while ago and solved it
by replacing two consecutive tabs with \t""\t. Now I see what the
problem was: When I'm not using R I'm using StatView and StatView
defaults to the tab as separator. (I don't remember what it was in
SPSS or Systat.) So I assumed that it's the same with R.
I didn't notice the sep = "" in the Usage section of the help page.
To make the default value more visible in this case it would be
nice if in the Arguments/sep section for read.table it would read
... If sep = "" (the default) the separator is ...
(Must've said "blimey" once too often -
now I'm really blind every now and then ;)
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help