library(stargazer)
t <- data.frame(Income = runif(20), 
                Wealth = runif(20), 
                Children = runif(20), 
                Age = runif(20), 
                male = rep(c(T,F),times=10))

Columns for different dependent variables

c1 <- lm(Income ~ Age, data = t, subset = male == T)
c2 <- lm(Wealth ~ Age, data = t, subset = male == F)
c3 <- lm(Children ~ Age, data = t)
stargazer(c1,c2,c3,
          style="aer", 
          omit.table.layout = "n", 
          omit.stat=c("adj.rsq", "f", "ser"), 
          omit=c("Constant"), 
          float=T, 
          title = "Columns for dependent variables",
          add.lines = list(c("Controls","N","N","N")))

Columns are different subsamples/controls

c1 <- lm(Income ~ Age, data = t, subset = male == T)
c2 <- lm(Income ~ Age, data = t, subset = male == F)
c3 <- lm(Income ~ Age, data = t)
stargazer(c1,c2,c3,
          style="aer", 
          omit.table.layout = "n", 
          omit.stat=c("adj.rsq", "f", "ser"), 
          omit=c("Constant"), 
          float=T, 
          title = "Columns for different subsamples/controls",
          add.lines = list(c("Controls","N","N","N")), 
          column.labels = c("Men","Women","All"),
          dep.var.caption = "\\textit{Dependent Variable: Income}",
          dep.var.labels.include = FALSE)

Mixed

c1 <- lm(Income ~ Age, data = t, subset = male == T)
c2 <- lm(Income ~ Age, data = t, subset = male == F)
c3 <- lm(Wealth ~ Age, data = t)
stargazer(c1,c2,c3, 
          style="aer", 
          omit.table.layout = "n", 
          omit.stat=c("adj.rsq", "f", "ser"), 
          omit=c("Constant"), 
          float=T, 
          title = "Mixed",
          add.lines = list(c("Controls","N","N","N")), 
          column.labels = c("Men","Women","All"))


markwestcott34/stargazer-booktabs documentation built on May 21, 2019, 12:25 p.m.