I was trying to add labels to a dataset. The labels are always ordered alphabetically, instead of by value. Please help me out. The codes are:
sat.df<- data.frame(sapply(satdata, factor,
levels = c( 1, 2, 3, 4, 5, 9),
labels = c( "Not at all Satisfied", "Not satisfied", "Neural",
"Satisfied", "Very Satisfied", "Not Applicable")))
The summary results I got are:
q1 Q6_a
Neural :116 Neural : 35
Not Applicable : 25 Not Applicable : 47
Not at all Satisfied: 13 Not at all Satisfied: 1
Not satisfied : 32 Not satisfied : 14
Satisfied :325 Satisfied :132
Very Satisfied :399 Very Satisfied :171
NA's : 6 NA's :516
I wonder if there's a way to reorder them from 1 to 9. Thank you very much!