Skip to content
Prev 11776 / 398502 Next

read.table and missing values

On Tue, 19 Jun 2001, Peter Breuer wrote:

            
It's the default ....
It works as documented, and as documented does what you want (so no
further hint is needed).  For file foo.dat

a,b,c
1,2,3
4,,6
,8,9

I get
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,

a	b	c
1	2	3
4		6
	8	9

and gives
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).