Learn R Programming

yamlme (version 0.1.2)

write_rmd: Writing R-Markdown Documents

Description

This function generates 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.

Usage

write_rmd(object, ...)

# S3 method for rmd_doc write_rmd(object, filename, ...)

Value

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

Arguments

object

rmd_doc object used to write an Rmarkdown file. If header is missing, write_rmd() will fail with an error message.

...

Further arguments passed among methods (not yet used).

filename

A character value with the name of the file to be written. If not included, the extension *.Rmd will be appended to this name. If missing, no file will be written by this function.

Examples

Run this code
if (FALSE) {
my_document <- list(
  title = "Sample Document",
  author = "Miguel Alavarez",
  output = "html_document",
  body = txt_body(
    "# Intro",
    "",
    "This is just an example."
  )
)
my_document <- as(my_document, "rmd_doc")
write_rmd(my_document, filename = file.path(tempdir(), "example"))
}

Run the code above in your browser using DataLab