View source: R/save_htmlwidget.R
save_widget | R Documentation |
Convenience wrapper around htmlwidgets::saveWidget
save_widget( widget, path, title = class(widget)[[1]], type = "direct", ..., libdir = NULL, libpath = "relative" )
widget |
htmlwidget |
path |
Where to save HTML file |
title |
Title of HTML page |
type |
One of |
libdir |
Directory for HTML dependencies (if |
libpath |
Specify |
There are three ways to save an htmlwidget. If type
is "direct"
,
a self-contained HTML file is saved as usual. save_widget
helps in this case
due to an apparent bug in saveWidget
if attempting to save to a directory
other than the current working directory.
If type
is "lib"
, a non-self-contained HTML file is created. In this
case, "libdir"
may be provided. Also, "libpath"
may be provided as either
"relative"
(default) or "absolute"
, which specifies whether paths
in the html file to the library files are relative or absolute. In contrast to
previous function save_leaflet
, "libdir"
does not necessarily need
to be a child of the directory containing path
.
If type
is "intermediate"
, a self-contained HTML file is generated, but
through an intermediate step of first creating a non-self-contained HTML file, then
producing the self-contained file from this by writing a new HTML after copying the
HTML dependencies into the HTML file. This can be useful when saving large htmlwidgets,
as the attempt to save as a self-contained file using saveWidget
will
fail on a pandoc memory error. This approach enables the saving of larger
widgets as self-contained HTML files.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.