| convert_table2png | R Documentation |
convert_table2png will take various types of table object formats and convert them to a png image.
convert_table2png(obj, name, rez = 600, interpreter = "xtable", ...)
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 |
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.
A png file saved to working directory.
Inspired/adapted by a post from Michael Yan's blog: http://thinkdatascience.com/
convert_table2png(mtcars, 'carsTable', 600, interpreter = 'xtable')
convert_table2png(mtcars, 'carsTable', 600, interpreter = 'xtable', texi2dvi = 'emulation')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.