50% off | Unlimited Data & AI Learning
Get 50% off unlimited learning

tatoo (version 1.1.2)

as_latex: Convert a Table to Latex Code

Description

as_latex() converts an R Object (currently Tatoo_tables and data.frames) to latex code.

save_pdf() is a wrapper around as_latex() for directly saving an R object to .pdf.

view_pdf() is another wrapper for directly viewing an R Object's pdf representation on a pdf viewer (powered by open_file()).

Usage

as_latex(x, ..., kable_options = default_kable_options())

save_pdf( x, outfile, ..., overwrite = FALSE, papersize = "a4paper", orientation = "portrait", keep_source = FALSE, template = system.file("templates", "save_tex.Rmd", package = "tatoo") )

view_pdf(x, ...)

Value

as_latex()returns a character scalar of Latex code

save_pdf() returns a the path to the saved file as character

scalar.

view_pdf() returns NULL (invisibly)

Arguments

x

a Tatoo_table, data.frame or a list of data.frames

...

passed on to methods

kable_options

list. Options passed on to knitr::kable(). See default_kable_options() for details.

outfile

character scalar. Path to the output file

overwrite

If TRUE, overwrite any existing file.

papersize

character scalar. Passed on to the latex command \\geometry from the 'geometry' package. Valid values are: a0paper, a1paper, a2paper, a3paper, a4paper, a5paper, a6paper, b0paper, b1paper, b2paper, b3paper, b4paper, b5paper, b6paper, c0paper, c1paper, c2paper, c3paper, c4paper, c5paper, c6paper, b0j, b1j, b2j, b3j, b4j, b5j, b6j, ansiapaper, ansibpaper, ansicpaper, ansidpaper, ansiepaper, letterpaper, executivepaper, legalpaper

orientation

character scalar. Passed on to the latex command \\geometry from the 'geometry' package. Valid values are: portrait, landscape

keep_source

When saving a pdf, also put the Latex source in the same directory.

template

Latex template for the desired output. Use the template file supplied in this package if you want to create your own.

Latex Packages

as_latex requires that the following Latex packages are installed on your system:

\usepackage{booktabs}
\usepackage{longtable}
\usepackage{threeparttablex}

Details

as_latex() and co. are designed to produce nice looking output with a minimum of user input required. This is useful if you want a quick preview or printout of a table. If you need customized Latex the output, you should take a look at the packages kableExtra::kableExtra, xtable, or huxtable.

See Also

Other as_latex methods: as_latex.Composite_table(), as_latex.Mashed_table(), as_latex.Tagged_table(), as_latex.Tatoo_report(), as_latex.data.frame()

Examples

Run this code
  as_latex(iris)

if (FALSE) {
  view_pdf(iris)  # Not supported on all systems
}


Run the code above in your browser using DataLab