Hi to all,
I am having a problem when using recode from the car package. I have
a variable that is char and when I use recode to create a new
variable that is supposed to be numeric I get a factor variable. Here
is the code I am using:
> FCI$PRE1 <- recode (PRE1RES, " c('C', 'c')=1 ; else = 0 ;
as.factor.result=FALSE ")
So, if I understand correctly the recode command, the line above
should create FCI$PRE1 variable with 1 if PRE1RES is c and zero
otherwise. However, if I type
> FCI$PRE1[0]
I get as result:
factor(0)
Levels: 0 1
FCI$PRE1 is not a numeric variable, and I get instead a factor.
Recode seems to work fine as it correctly replaces the c's for 1 and
other results for 0, but the fact that the recoded variable is a
factor does not work for me.
Any suggestions on what I am doing wrong?
I am using R 1.7.1 (2) on a Windows XP machine.
Thanks,
Julie
[[alternative HTML version deleted]]
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help