[R] New factor from two olds factors
Jorge Magalhães
jmagalhaes at oninetspeed.pt
Thu May 1 15:41:40 CEST 2003
Hi,
Suppose i have two factors:
factor1<-Structure(factor(c(1,3,2,1,2,1,2,1,3),levels=1:3),
.Label=c("Yes","No","NY")))
factor2<-Structure(factor(c(2,1,2,1,3,2,2,1,3),levels=1:3),
.Label=c("Yes","No", "NY")))
i want define a new factor from the factors 1 and 2. For that i tried:
>array3<- is.numeric(factor1)+is.numeric(factor2)
array3=(3,4,4,2,5,3,4,2,6)
Now i need to define two new classes: if 2,3 and 4 ----->> class1 else class2
What is the best way for making that?
Thanks in the advance.
Jorge M.
More information about the R-help
mailing list