[R] read.table and missing values - solved

Peter Breuer pbreuer at uni-goettingen.de
Tue Jun 19 17:08:52 CEST 2001


Thanks - everything is o.k. and working

>a,b,c
>1,2,3
>4,,6
>,8,9
>
>I get
>
>>  read.table("foo.dat", header=T, sep=",")
>    a  b c
>1  1  2 3
>2  4 NA 6
>3 NA  8 9
>
>as advertised.
>
>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,

This did solve the problem. I didn't set sep="\t". R read complete
tab delimited data files nontheless and complained only when it met 
missing data.
This confused me.

>
>a	b	c
>1	2	3
>4		6
>	8	9
>
>and gives
>
>>  read.table("foo.dat", header=T, sep="\t")
>    a  b c
>1  1  2 3
>2  4 NA 6
>3 NA  8 9
>
>So, if you do that it should work for you too.  And if you want to claim
>on R-help that things do not work, please include an example so we can see
>what you are doing (or not doing).
>
sorry for having missed to send an example.

Peter

-- 
---------------------------------------------------------------------
Peter Breuer, http://www.psych.uni-goettingen.de/home/breuer
Georg-Elias-Mueller-Inst. f. Psychologie, Gosslerstr. 14, 37073 
Goettingen, Germany
Tel: (+49)551-39-3588,  Fax: (+49)551-39-3662
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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 mailing list