Learn R Programming

modelsummary (version 0.2.0)

clean_latex: Utility function to cleanup LaTeX output from gt and ensures that it compiles with latex

Description

The `gt::as_latex` function is still in development, rather feature poor, and prone to breakage. This function is a stopgap measure which adds a little functionality and "cleans-up" some of the LaTeX output to avoid common compilation errors. In time, as upstream improves, the goal is to deprecate this function.

Usage

clean_latex(
  tab,
  label = NULL,
  latex_env = "longtable",
  gof_regex = "^Num Obs."
)

Arguments

tab

table object produced by `modelsummary` or `gt`

label

string will be inserted as a `label`

latex_env

the default LaTeX environment is longtable. Fix this argument to 'table' if you want to use a tabular nested inside a table.

gof_regex

regex which identifies the first GOF statistic. Used to figure out where to insert a midrule to separate coefficients from GOFs.

Value

a string object with LaTeX code