R Categorical Variable Orders for plotting -


on right hand side current order of categorical variable

i'm trying change order "charged off" , "default" @ bottom while rest of them remains unchanged. can't seem either reorder or relevel work. of time error

error: unexpected string constant in "post09$loanstatus <- relevel(post09$loanstatus, ref = c("cancelled", completed", "" 

try , let me know if works -

data <- factor(letters[1:10]) data1 <- c("i","j",setdiff(data,c("i","j"))) data_reordered <- factor(data1, levels=data1) 

if not, please share more info regarding question along reproducible example!


Comments