gt_render_image {nflplotR} | R Documentation |
Render 'gt' Table to Temporary png File
Description
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).
Usage
gt_render_image(gt_tbl, ...)
Arguments
gt_tbl |
An object of class |
... |
Arguments passed on to |
Details
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 "true"
. 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 can be taken from the source code of this
function.
Value
Returns NULL
invisibly.
Examples
tbl <- gt::gt_preview(mtcars)
gt_render_image(tbl)