Description Usage Arguments See Also Examples
View source: R/provide_parameters.R
R Markdown documents allow you to pass almost any object – including large
data frames and functions – to the document as parameters, letting you
only define them once to use them in both your document generator and
the generated document. This function makes it slightly easier to do so,
by automatically creating a named list from provided objects rather than
requiring a named list. This function is a stripped-down variant of
lst
.
1 |
... |
Objects to be included as parameters. Objects should be unquoted and exist in the current session environment. |
Other manipulation functions:
create_yaml_header()
,
heddle()
,
make_template()
,
use_parameters()
1 2 3 4 5 6 7 8 9 10 11 12 | template <- make_template(
"---\ntitle: Example\noutput: html_document\n---\n",
"\nThe random number is `r random_number`.\n"
)
template <- use_parameters(template, "random_number")
pattern_file <- tempfile("out", tempdir(), ".Rmd")
export_template(template, pattern_file)
random_number <- rnorm(1)
if (rmarkdown::pandoc_available()) {
rmarkdown::render(pattern_file, params = provide_parameters(random_number))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.