This function generates YAML headers and R-Markdown documents by including the settings as arguments of the function. Comments and pieces of header can be also added through the argument append.

write_rmd(..., append, body = "", filename)



Named arguments to be inserted in the YAML header. These arguments may be inserted either as vectors or lists.


A piece of code to be appended in the header. For instance, it can contain commented code.


The content of the document that will be inserted after the header.


A character value with the name of the file to be written (usually a *.Rmd file). If missing, no file will be written by this function.


A character vector of class rmd_doc and, if argument set for parameter filename, an Rmd file.


if (FALSE) { my_document <- write_rmd( title = "Sample Document", author = "Miguel Alavarez", output = "html_document", body = txt_body( "# Intro", "", "This is just an example.")) my_document }