I would like to create a nominal variable X
(factor) in my data.frame
from two other already-existing nominal variables Renda
and Escolaridade
:
Renda Escolaridade X
baixa fund. incomp Sim
inter superior Nao
alta pos grad Nao
alta medio Nao
Thus, when Renda = "baixa"
and Escolaridade = "fund. incomp"
a var. X
will receive label= "Sim"
and all other combinations will receive label="Nao"
I tried to use the ifelse
function, but it seems to apply to var. numeric
only.