I'm having a bit of trouble recoding factors in a fields. I have a field which has the factors Singleton, Twin and Triplet. I want to recode the field to have only the factors Singleton and Multiple. Any advice? Cheers, Neil
Neil Leonard wrote:> I'm having a bit of trouble recoding factors in a fields. > > I have a field which has the factors Singleton, Twin and Triplet. > I want to recode the field to have only the factors Singleton and Multiple.>> Any advice?Depends on what you are going to do with the Twin ... Uwe Ligges> Cheers, > 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
See ?levels. I think you want something like the following:
levels(myfact) <- c("Singleton", "Multiple",
"Multiple")
Neil Leonard wrote:> I'm having a bit of trouble recoding factors in a fields.
>
> I have a field which has the factors Singleton, Twin and Triplet.
> I want to recode the field to have only the factors Singleton and Multiple.
>
> Any advice?
--
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 452-1424 (M, W, F)
fax: (917) 438-0894