I'm working with ggcoef_compare
to plot coefficients from two separate models. I want to specify the variable order.
The issue: my code worked in August, but it no longer specifies the correct variable order today. I've updated all the necessary packages (ggplot2
, GGally
), but I can't figure out what I'm doing wrong.
It's hard to provide a reproduce example of my code because I'm working with spatial models, but here is the code for my plot:
models <- list("OLS" = ols, "Spatial Error" = err)
ggcoef_compare(models,
variable_labels = c(
localtaxrate = "Local Tax Rate",
unemprate = "Unemployment Rate",
gini_mean = "Gini",
theil_race = "Racial Segregation",
pctblack = "Percent Black",
`log(pop)` = "Population (log)"),
facet_labeller = label_wrap_gen(15),
conf.int = TRUE, conf.level = 0.95,
significance = NULL)
When I run this code, the plot displays variables in alphabetical order: Gini, Local Tax Rate, Population, Percent Black, Racial Segregation, Unemployment Rate. I should also note that when I run my models (ols
and err
), I order the variables the same way I list them in my code for ggcoef_compare
.