I would like to manually sort the coefficients in a coefplot. Previous questions only achieve ordering by (decreased) magnitude, which is not what I want.
Consider the below example:
library(coefplot)
data(tips, package = "reshape2")
mod1 <- lm(tip ~ day + sex + smoker + sex * smoker, data = tips)
coefplot.glm(mod1)
How would I achieve a coefficient order with sexMale:smokerYes on top and daySat, dayThu, daySun (and then the rest) without relying on their magnitude?
Thanks in advance for pointing me to a solution. :)
Because
coefplot.glm()is outputting aggplotobject, you can access the data object and re-level the y factor:Create
ggplotobjectRe-level y factor