gt_render_image | R Documentation |
Saves a gt table to a temporary png image file and uses magick to render
tables in reproducible examples like reprex::reprex()
or in package
function examples (see details for further information).
gt_render_image(gt_tbl, ...)
gt_tbl |
An object of class |
... |
Arguments passed on to |
Rendering gt tables in function examples is not trivial because
of the behavior of an underlying dependency: chromote. It keeps a process
running even if the chromote session is closed. Unfortunately, this causes
R CMD Check errors related to open connections after example runs. The only
way to avoid this is setting the environment variable _R_CHECK_CONNECTIONS_LEFT_OPEN_
to "false"
. How to do that depends on where and how developers check their
package. A good way to prevent an example from being executed because the
environment variable was not set to "false"
can be taken from the source
code of this function.
Returns NULL
invisibly.
tbl <- gt::gt_preview(mtcars)
gt_render_image(tbl)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.