README.md

regTeX

An R package to export model estimates to LaTeX. Supports:

Installation

if (!require(devtools)) install.packages("devtools")
devtools::install_github("walshc/regTex")

Usage

Use help(regTex) within R for the full documentation on the function. In your LaTeX file, you need \usepackage{siunitx} in the preamble. Here is a simple example:

require(regTex)

## Create fake data:
N <- 200
test.df <- data.frame(a = rnorm(N), b = runif(N), c =  rpois(N, 2),
                      d = sample(0:1, N, replace = TRUE))

## Run some regresions:
regs <- list()
regs[[1]] <- lm(a ~ b + c, test.df)
regs[[2]] <- lm(a ~ b + d, test.df)
regs[[3]] <- lm(b ~ c + d, test.df)

## Set up the inputs to the function:
vars <- list(b = c("Variable B"),
             c = c("Variable C"),
             d = c("Long label", "for D"))
depvars <- list("Variable A", "Variable A", c("Long", "label B"))
fe <- list(c("State Fixed Effects", "Yes", "No", "No"),
           c("Year Fixed Effects",  "No",  "No", "Yes"))

## Write LaTeX output:
regTex(regs = regs, vars = vars, depvars = depvars, fixed.effects = fe,
       intercept = TRUE)

Example Output



walshc/regTex documentation built on May 3, 2019, 11:51 p.m.