with_example | R Documentation |
This function primarily exists to ensure that the examples in this package
are readable. But you can also use with_example()
to try out the various
output functions.
with_example( example, code, clean = TRUE, requires_packages = NULL, requires_chrome = FALSE )
example |
The name of the example file, currently only |
code |
The code expression to evaluate. You can use the example as an
input by referencing it directly, e.g. |
clean |
Should the example file and any extra files be cleaned up when
the function exits? The default is |
Invisibly returns the path to the temp directory where the example
was created when clean = FALSE
, otherwise invisibly returns the output
from evaluating expr
.
with_example("slides.Rmd", { to_html("slides.Rmd") }) print(with_example("slides.Rmd", getwd()))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.