Use this function to turn an stable object in to a high-quality pdf file, The result can be included in an Rmarkdown file rendered to .html or other uses.

st_as_image(x, ...)

# S3 method for class 'stable'
st_as_image(
  x,
  width = getOption("pmtables.image.width", 0.95),
  border = getOption("pmtables.image.border", "0.2cm 0.7cm"),
  ...
)

# S3 method for class 'pmtable'
st_as_image(x, ...)

# S3 method for class 'stobject'
st_as_image(x, ...)

Arguments

x

an stable object; this can be the result of calling stable() or stable_long().

...

arguments passed to st_aspdf(); please take the time to review the details in that help topic.

width

the relative width of the image; passed to st_image_show(); this must be greater than 0 and less than or equal to 1.

border

passed as an option to standalone latex output type; see details.

Value

A possibly resized magick image object (see magick::image_read_pdf()).

Details

This function depends on the magick and pdftools packages being installed.

  1. First, x is rendered with st_aspdf()

  2. Next, the pdf file is read using magick::image_read_pdf()

  3. Finally, the image is possibly resized via st_image_show()