I place the following data in a file

id       rs835   rs169   rs174
1001     CC      GG      CC
10032    CC      GG      CC
10066    CC      NA      CC

If I read it in as
tempDat <- read.table("tempDat.txt",na.strings="NA",header=TRUE)

I get the following.

     id rs835 rs169 rs174
1  1001    CC    GG    CC
2 10032    CC    GG    CC
3 10066    CC  <NA>    CC

NA has been assigned a missing value.

If I add the separator

tempDat <- read.table("tempDat.txt",na.strings="NA",sep="\t",header=TRUE)
tempDat
     id rs835 rs169 rs174
1  1001   CC    GG     CC
2 10032   CC    GG     CC
3 10066   CC    NA     CC

NA does not get assigned a missing value.

Could you help me understand the logic of this. Thanks!

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to