View source: R/preview-standalone.R
stable_save_image | R Documentation |
Render and save a table in png or pdf format
stable_save_image(
x,
file = attr(x, "stable_file"),
stem = NULL,
format = c("png", "pdf"),
dir = getOption("pmtables.dir"),
build_dir = tempdir(),
...
)
x |
an stable object. |
file |
the final output file name; if |
stem |
used to form the final output file name; this argument will
override what is provided in |
format |
the output file format. |
dir |
the final output directory; will be overridden if |
build_dir |
the directory where the image will be built. |
... |
passed to |
There is considerable flexibility for specifying the output file name. This flexibility is provided to accommodate several potential different anticipated workflows.
file
can be obtained from the stable_file
attribute on x
; this
attribute is set when the user specifies the output file name via
st_files()
; if a .tex
extension is found on file
, it will be
changed to the value found in format
; in this case, file
is not
expected to contain the full path and the output directory can be
specified by dir
file
can be passed by the user; in this case, a complete path can
be provided to the output file; this path will override
what is in dir
and a warning is given in case path location is found in
both sources; if a .tex
extension is found on file
, it will be changed
to the value found in format
stem
and format
can be passed and the output file name will be
<dir>/<stem>.<format>
st_as_image()
tab <- stable(stdata(), output_file = "foo.tex")
## Not run:
ans <- stable_save_image(tab, format = "pdf")
basename(ans)
st_image_show(ans)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.