0

I am plotting my coefficient estimates using the function plot_summs() and would like to divide my coefficients into two separate groups.

The function plot_summs() has an argument groups, however, when I try to use it as explained in the documentation, I do not get any results nor error. Can someone give me an example of how I can use this argument please?

This is the code I currently have:

plot_summs(model.c, scale = TRUE, groups = list(pane_1 = c("AQI_average", "temp_yearly"), pane_2 = c("rain_1h_yearly", "snow_1h_yearly")), coefs = c("AQI Average"= "AQI_average", "Temperature (in Farenheit)" = "temp_yearly","Rain volume in mm" = "rain_1h_yearly", "Snow volume in mm" = "snow_1h_yearly"))

And the image below is what I get as a result. What I would like to get is to have two panes separate panes. One which would include "AQI_average" and "temp_yearly" and the other one that would have "rain_1h_yearly" and "snow_1h_yearly". Event though I use the groups argument, I do not get this.

Output of my code

teki13
  • 1
  • 1
  • Hi and welcome to SO. Can you add a [minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) ? – markus Oct 11 '20 at 17:51
  • Hi, thank you. I have just uploaded my code and output. Thanks! – teki13 Oct 11 '20 at 18:02

1 Answers1

0

By minimal reproducible example, markus is refering to a piece of code that enables others to exactly reproduce the issue you are refering to on our respective computers, as described in the link that they provided.

To me, it seems the problem is that the groups function does not seem to work in plot_summs - it seems someone here also pointed it out.

If plot_summs is replaced by plot_coef, the groups function work for me. However, the scale function does not seem to be available. A workaround might be:

r <- lm(Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width, data = iris)

y <- plot_summs(r, scale = TRUE) #Plot for scaled version
t <- plot_coefs(r, #Plot for unscaled versions but with facetting
                groups = 
                  list(
                    pane_1 = c("Sepal.Width", "Petal.Length"), 
                    pane_2 = c("Petal.Width"))) + theme_linedraw()

y$data$group <- t$data$group #Add faceting column to data for the plot
t$data <- y$data #Replace the data with the scaled version

t

I hope this is what you meant!

T. C. Nobel
  • 465
  • 2
  • 9