Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Potential bug in stargazer omit.labels

Tags:

r

stargazer

There appears to be a bug in version 5.2 of the stargazer package, where the omit.label functionality does not work consistently depending on the order of the included models:

library(stargazer)
library(ggplot2)
as.data.frame(data("midwest"))
fit.1 <- lm(poptotal ~ popadults, data = midwest)
fit.2 <- lm(poptotal ~ popadults + state, data = midwest)

# Works, column listed as "Yes":
stargazer(fit.2, omit = c("state"), omit.labels = c("States"))
# Does not work, both columns listed as "No":
stargazer(fit.1, fit.2, omit = c("state"), omit.labels = c("States"))
# Works, first column "Yes", second "No":
stargazer(fit.2, fit.1, omit = c("state"), omit.labels = c("States"))

Does anyone know of a workaround?

like image 920
Bryan Avatar asked Jul 13 '16 15:07

Bryan


Video Answer


1 Answers

I just manually specified dummies for each column using the add.lines property. For your example:

stargazer(fit.1, fit.2, omit = c("state"),
    add.lines = list(
        c("States", "No", "Yes")
    )
)
like image 153
Jasper Clarkberg Avatar answered Oct 11 '22 14:10

Jasper Clarkberg