convert_table2png: Convert a table object to a png file

View source: R/convert.R

convert_table2pngR Documentation

Convert a table object to a png file

Description

convert_table2png will take various types of table object formats and convert them to a png image.

Usage

convert_table2png(obj, name, rez = 600, interpreter = "xtable", ...)

Arguments

obj

A table object (huxtable, xtable, or tables).

name

Character vector for naming output.

rez

Integer value for desired resolution (default is 600).

interpreter

Character vector to define which type of table object was used (huxtable, xtable, or tables).

...

Additional parameters passed to texi2dvi.

Details

To create the png file, a LaTeX distribution, and texi2dvi (from base R) are required. It is recommended to use install_tinytex. Various LaTeX packages may be needed, specifically 'tabularx' and 'dvipng' should be installed using tinytex::tlmgr_install('dvipng')

On some Linux machines, the texi2dvi operation may not work without additional configuration. As such, the parameter texi2dvi parameter should be set to emulation. This has been tested with xtable but the other interpreters may have additional dependencies beyond this work-around.

Value

A png file saved to working directory.

Source

Inspired/adapted by a post from Michael Yan's blog: http://thinkdatascience.com/

Examples

convert_table2png(mtcars, 'carsTable', 600, interpreter = 'xtable')
convert_table2png(mtcars, 'carsTable', 600, interpreter = 'xtable', texi2dvi = 'emulation')


al-obrien/farrago documentation built on April 14, 2023, 6:20 p.m.