[R] read.table, NA assignment, and sep
Juliet Hannah
juliet.hannah at gmail.com
Thu Jul 3 16:40:28 CEST 2008
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!
More information about the R-help
mailing list