[R] Declaring All Variables as Factors in GLM()
Preetam Pal
lordpreetam at gmail.com
Sat Apr 30 09:25:05 CEST 2016
Hi guys,
I am running glm(y~., data = history,family=binomial)-essentially, logistic
regression for credit scoring (y = 0 or 1). The dataset 'history' has 14
variables, a few examples:
history <- read.csv("history.csv". header = TRUE)
1> 'income = 100,200,300 (these are numbers in my dataset; however
interpretation is that these are just tags or labels,for every observation,
its income gets assigned one of these tags)
2> 'job' = 'private','government','unemployed','student'
I want to declare all the regressors and y variables *as factors*
programmatically. Would be great if anyone can help me with this (idea is
to loop over variable names and use as.factor - but not sure how to do
this). Thanks
Regards,
Preetam
--
Preetam Pal
(+91)-9432212774
M-Stat 2nd Year, Room No. N-114
Statistics Division, C.V.Raman
Hall
Indian Statistical Institute, B.H.O.S.
Kolkata.
[[alternative HTML version deleted]]
More information about the R-help
mailing list