This function is a wrapper of rmarkdown::render()
and will also work with
file names but also enables the possibility of rendering from objects created
by write_rmd()
.
Usage
render_rmd(input, ...)
# S3 method for character
render_rmd(input, ...)
# S3 method for rmd_doc
render_rmd(input, output_file, delete_rmd = TRUE, ...)
Arguments
- input
Either a character value indicating the path and the name of the r-markdown file, or an object of class
rmd_doc
, written bywrite_rmd()
.- ...
Further parameters passed to
rmarkdown::render()
.- output_file
A character value indicating the name of the output file. This argument is passed to
rmarkdown::render()
. Note that the argument only contains the name of the file without extension and can only be written at the working directory.- delete_rmd
A logical value idicating whether the temporary Rmd file should be deleted or not. If not, the file gets the same name as the rendered file.
Examples
if (FALSE) {
## copy example to your working directory
filename <- "taxlistjourney.Rmd"
file.copy(from = file.path(path.package("yamlme"), filename), to = filename)
## Render the file with rmarkdown::render()
render_rmd(filename, output_file = "example")
browseURL("example.html")
## Render the file with yamlme
text_document <- read_rmd(filename)
text_document <- update(text_document,
title = "my title", author = "my name",
output = "html_document"
)
render_rmd(text_document, output_file = "example2")
browseURL("example2.html")
}