st_image_show: Show table output that has been saved to pdf or png format

View source: R/preview-standalone.R

st_image_showR Documentation

Show table output that has been saved to pdf or png format

Description

Show table output that has been saved to pdf or png format

Usage

st_image_show(
  path,
  width = getOption("pmtables.image.width", 0.95),
  knitting = getOption("knitr.in.progress")
)

Arguments

path

path to a png or pdf file saved on disk.

width

for resizing the magick object; must be a value greater than 0 and less than or equal to 1; when not knitting, the width is taken as a fraction of the current graphics device width; when knitting and the image is in png format, the width is taken to be a fraction of the available space; this parameter is ignored when knitting pdf output.

knitting

if TRUE, the context is assumed to be document knit (see default) and the magick object is returned after resizing; if FALSE, then interactive context is assumed and the magick object is returned after resizing according to the current device width.

Details

This function requires the magick and pdftools packages to be installed.

If you are not knitting an rmarkdown document, then the image is read using magick::image_read_pdf() (pdf files) or magick::image_read() (png files) and resized relative to the width of the current graphics device (see grDevices::dev.size()).

If you are knitting with pdf output, then the image is read in using magick::image_read_pdf() and passed through knitr::include_graphics() without resizing. If you are knitting with html output, then the image is read in using magick::image_read() and resized using magick::image_resize() to a certain fraction of the available space (see width argument).

Value

Depends the context; see details.

See Also

st_aspng(), st_aspdf(), st_as_image()


metrumresearchgroup/pmtables documentation built on Oct. 27, 2024, 5:16 p.m.