Skip to content
Prev 360540 / 398503 Next

Declaring All Variables as Factors in GLM()

This should do the trick:

history2 <- as.data.frame(lapply(history, as.factor))

Mind you that read.csv() by default reads string vectors as factors, so
that declaring the variables as factors should only be necessary for the
numeric ones, like income. Using as.factor() in factor variables may
drop unused levels, but in your case I believe it won't be a problem.

HTH,

Leonardo Ferreira Fontenelle
http://lattes.cnpq.br/9234772336296638

Em S?b 30 abr. 2016, ?s 04:25, Preetam Pal escreveu: