Hi,
I did try the code with the na.strings option but it did not work. The
factor bmicat still contains "NA" as one of its levels. Can read.table()
exclude "NA" values from the variables it reads from test.txt? If  not
what is the best way to remove these unwanted levels from a factor when
programming a function?
Thanks
Peter

>inrange<-read.table("C://test.txt", header=T, sep="|", 
na.strings=c("NA","."), colClasses=c(bmicat="factor"))
>summary(inrange)
bmicat
  <23   : 294
>28   :1482  
23-28 :1043
NA    :  13
> levels(bmicat)
[1] "<23 "   ">28 "   "23-28 " "NA "
> contrasts(bmicat)
       >28  23-28  NA
<23       0      0   0
>28       1      0   0
23-28     0      1   0
NA        0      0   1
>

______________________________________________
[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

Reply via email to