I haven't your dataset, but typing omit = c("Constant", "x2")
should work.
As a reproducible example (stargazer 5.2)
stargazer::stargazer(
lm(Fertility ~ . ,
data = swiss),
type = "text",
omit = c("Constant", "Agriculture"))
Edit: Add in omit.labels
mdls <- list(
m1 = lm(Days ~ -1 + Reaction, data = lme4::sleepstudy),
m2 = lm(Days ~ Reaction, data = lme4::sleepstudy),
m3 = lm(Days ~ Reaction + Subject, data = lme4::sleepstudy)
)
stargazer::stargazer(
mdls, type = "text", column.labels = c("Omit none", "Omit int.", "Omit int/subj"),
omit = c("Constant", "Subject"),
omit.labels = c("Intercept", "Subj."),
keep.stat = "n")
#>
#> ==============================================
#> Dependent variable:
#> ---------------------------------
#> Days
#> Omit none Omit int. Omit int/subj
#> (1) (2) (3)
#> ----------------------------------------------
#> Reaction 0.015*** 0.027*** 0.049***
#> (0.001) (0.003) (0.004)
#>
#> ----------------------------------------------
#> Intercept No No No
#> Subj. No No No
#> ----------------------------------------------
#> Observations 180 180 180
#> ==============================================
#> Note: *p<0.1; **p<0.05; ***p<0.01
Created on 2020-05-08 by the reprex package (v0.3.0)
Note the table should read. This appears to be a bug (stargazer 5.2.2).
#> Intercept No Yes Yes
#> Subj. No No Yes
omit
for its other purpose of e.g. collapsing and naming fixed effects. For example, it fails if you also passomit.labels=c("ag")
. – Sussex