[R] Remove Indeterminate Level

Liaw, Andy andy_liaw at merck.com
Thu Oct 7 16:37:05 CEST 2004


> sex <- factor(sample(c("M", "F"), 10, replace=TRUE), levels=c("M", "F",
> sex
 [1] F F M F F F M M M F
Levels: M F I
> sex2 <- sex[, drop=TRUE]
> sex2
 [1] F F M F F F M M M F
Levels: M F


> From: Neil Leonard
> Hi,
> I have imported some data to R from stata and my factor 
> variables have 
> an Indeterminate level which I don't really want. For example the 
> variable sex has the levels Male, Female and Indeterminate. There are 
> no 'Indeterminate' values in the data. Can somebody tell me 
> how to get 
> rid of this level as it restricting my cox ph model.
> Thanks
> Neil
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html

More information about the R-help mailing list