Saves everything opened in a current project, renders (compiles) chosen
.Rmd document(s), and opens the resulting file if everything went OK.
Arguments
- input
path to source
.Rmdfile- output_dir
output directory, default to "reports-output"
- open_on_success
if compilation went successul, open the result, default to TRUE
- ...
Arguments passed on to
rmarkdown::renderoutput_formatThe R Markdown output format to convert to. The option
"all"will render all formats defined within the file. The option can be the name of a format (e.g."html_document") and that will render the document to that single format. One can also use a vector of format names to render to multiple formats. Alternatively, you can pass an output format object (e.g.html_document()). If usingNULLthen the output format is the first one defined in the YAML frontmatter in the input file (this defaults to HTML if no format is specified there). If you pass an output format object tooutput_format, the options specified in the YAML header or_output.ymlwill be ignored and you must explicitly set all the options you want when you construct the object. If you pass a string, the output format will use the output parameters in the YAML header or_output.yml.output_fileThe name of the output file. If using
NULLthen the output filename will be based on filename for the input file. If a filename is provided, a path to the output file can also be provided. Note that theoutput_diroption allows for specifying the output file path as well, however, if also specifying the path, the directory must exist. Ifoutput_fileis specified but does not have a file extension, an extension will be automatically added according to the output format. To avoid the automatic file extension, put theoutput_filevalue inI(), e.g.,I('my-output').output_optionsList of output options that can override the options specified in metadata (e.g. could be used to force
self_containedormathjax = "local"). Note that this is only valid when the output format is read from metadata (i.e. not a custom format object passed tooutput_format).output_yamlPaths to YAML files specifying output formats and their configurations. The first existing one is used. If none are found, then the function searches YAML files specified to the
output_yamltop-level parameter in the YAML front matter, _output.yml or _output.yaml, and then uses the first existing one.intermediates_dirIntermediate files directory. If a path is specified then intermediate files will be written to that path. If
NULL, intermediate files are written to the same directory as the input file.knit_root_dirThe working directory in which to knit the document; uses knitr's
root.dirknit option. IfNULLthen the behavior will follow the knitr default, which is to use the parent directory of the document.runtimeThe runtime target for rendering. The
staticoption produces output intended for static files;shinyproduces output suitable for use in a Shiny document (seerun). The default,auto, allows theruntimetarget specified in the YAML metadata to take precedence, and renders for astaticruntime target otherwise.cleanUsing
TRUEwill clean intermediate files that are created during rendering.paramsA list of named parameters that override custom params specified within the YAML front-matter (e.g. specifying a dataset to read or a date range to confine output to). Pass
"ask"to start an application that helps guide parameter configuration.knit_meta(This option is reserved for expert use.) Metadata generated by knitr.
envirThe environment in which the code chunks are to be evaluated during knitting (can use
new.env()to guarantee an empty new environment).run_pandocAn option for whether to run pandoc to convert Markdown output.
quietAn option to suppress printing during rendering from knitr, pandoc command line and others. To only suppress printing of the last "Output created: " message, you can set
rmarkdown.render.messagetoFALSEencodingIgnored. The encoding is always assumed to be UTF-8.
Examples
if (FALSE) { # \dontrun{
# for which REDIZOs should the reports be compiled?
red_izos <- c("600000001", "600000002", "600000003")
purrr::map(
red_izos,
~ compile_and_open("05_ucitele-reditele_ms.Rmd",
open_on_success = FALSE,
output_dir = here("reports-output", "ucitele-reditele-ms"),
output_file = paste0("02_ucitele-reditele-ms_", .x, ".docx"),
params = list(redizo = .x)
)
)
} # }