examples/regTex-example.R

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", "Variable 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, stats = c("N", "adj.R.squared"))
walshc/regTex documentation built on May 3, 2019, 11:51 p.m.