suTex: Write summary statistics to LaTeX

Description Usage Arguments Examples

View source: R/suTex.R

Description

A flexible way to create a publication-worthy summary statistics tables in LaTeX. Requires the siunitx LaTeX package for compilation.

Usage

1
2
3
suTex(vars, file = NULL, data,
      stats = c("mean", "sd", "min", "median", "max", "nObs"),
      number.format = "%.2f")

Arguments

vars

A list of variable labels. The names of each element must corresond to a variable contained in data. For example, if two variables contained in data are var1 and var2:

vars <- list(var1 = "Variable Label 1", var2 = "Variable Label 2")

file

The .tex file to save to. If excluded it will print the output to the screen.

data

The data.frame to summarize.

stats

Which statistics to include. This can include any arbitrary functions.

number.format

Number format as in the sprintf function. Default is two decimal places ("%.2f").

Examples

1
2
3
df <- data.frame(var1 = rnorm(20), var2 = runif(20))
vars <- list(var1 = "Variable 1", var2 = "Variable 2")
suTex(vars, data = df, stats = c("mean", "sd", "min", "max", "nObs"))

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