Juliet Hannah wrote:
> 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!
>
This kind of thing doesn't travel well in email, but is is possible that
there is more than "\t" between fields?
levels(tempDat$rs169) could be illuminating.
--
O__ ---- Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907
______________________________________________
[email protected] 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.