19.2 Latex and R

  • Crosstables: library(xtable)
library(foreign)
mytable <- table(swiss$Education, swiss$Examination)
library(xtable)
xtable(mytable) # Latex
  • Summary statistics: library(stargazer)
library(stargazer)
stargazer(swiss)

Regression tables

  • apsrtable
install.packages("apsrtable")
library(apsrtable)
y <- rnorm(100)
x1 <- rnorm(100)
x2 <- rnorm(100)
fit1 <- lm(y ~ x1)
fit2 <- lm(y ~ x1 + x2)
apsrtable(fit1, fit2)
  • Nice out-of-the-box tool
  • robust standard errors are supported

  • stargazer

stargazer(fit1, fit2)
?stargazer
  • Best out-of-the-box-tool
  • robust standard errors are supported