[R] excluding factor levels with read.table() and colClasses=

Peter Tait petertait at sympatico.ca
Thu Mar 16 04:37:22 CET 2006


Hi,

I am reading a "|" delimited text file into R using read.table(). I am 
using colClasses= to specify some variables as factors. Some of these 
variables include missing values coded as "NA". Unfortunately the R code 
I am using (pasted bellow) includes "NA" as one of the factor levels. Is 
it possible to remove the "NA" level from a factor with in 
read.table()?  If not  what is the most efficient  way of doing this?
 
inrange<-read.table("C://...",header=T,sep="|",colClasses=c( id="factor"))

Thanks for your help.
Peter




More information about the R-help mailing list