Export a tibble as a publication-quality LaTeX table
Source:R/write_manuscript.R
export_latex_table.RdProduces a booktabs-style table using \\botrule instead of
\\bottomrule and escaping </> in cells. Optionally appends
a tablenotes footnote.
Usage
export_latex_table(
data,
filename,
caption,
label,
note = NULL,
digits = 3,
col_format = NULL
)Arguments
- data
A tibble/data.frame.
- filename
Character. Output
.texpath.- caption
Character. Table caption.
- label
Character. LaTeX label (without the
tab:prefix; it will be added).- note
Character. Optional footnote text.
- digits
Integer. Digits for numeric columns. Default
3.- col_format
Character vector. Column alignment spec (e.g.
c("l", "r", "r")). DefaultNULLpicks"l"for the first column and"r"for the rest.
Examples
if (FALSE) { # \dontrun{
export_latex_table(head(iris), "iris.tex",
caption = "First rows of iris.",
label = "iris")
} # }