[R] Converting a Vector into a 2-level Factor
ntyson at clovermail.net
ntyson at clovermail.net
Thu Oct 22 08:36:38 CEST 2009
Hello Everyone,
Let's say I have a vector as follows:
vowels = c("aa", "aa", "ah", "ao", "eh)
I want to make a factor consisting of two levels: the things that are
"aa" and those that are not "aa". How would I do that?
I tried using factor(vowels, levels=c("aa", "~aa"), exclude=NULL), but
this gives me '<NA>' or missing values, which is not what I want. If
there is no way to get two levels, then how do I convert the NAs to
another symbol of my choosing?
Any suggestions are welcome.
Thanks.
More information about the R-help
mailing list