I need some help with coding factors for a logistic regression.
What I have are six dummy variables representing income brackets. I want to convert these into a single ordered factor for use in a logistic regression.
My data frame looks like:
INC1 INC2 INC3 INC4 INC5 INC6
1 0 0 1 0 0 0
2 NA NA NA NA NA NA
3 0 0 0 0 0 1
4 0 0 0 0 0 1
5 0 0 1 0 0 0
6 0 0 0 1 0 0
7 0 0 1 0 0 0
8 0 0 0 1 0 0
What I want it to look like:
INC
1 INC3
2 NA
3 INC6
4 INC6
5 INC3
6 INC4
7 INC3
8 INC4
This must be a common (and simple) operation, but my searches have not turned up a concise answer for how to perform this re-coding. Any help is very much appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…