provide_parameters {heddlr} | R Documentation |
Easily provide parameters to R Markdown render calls
Description
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
.
Usage
provide_parameters(...)
Arguments
... |
Objects to be included as parameters. Objects should be unquoted and exist in the current session environment. |
See Also
Other manipulation functions:
create_yaml_header()
,
heddle()
,
make_template()
,
use_parameters()
Examples
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))
}
[Package heddlr version 0.6.0 Index]