Learn R Programming

yamlme (version 0.1.2)

update: Update an rmd_doc

Description

Alternative to modify settings and content in rmd_doc objects. Note that to skip some elements of the YAML header, you can set the argument NULL to the respective parameter.

Usage

# S3 method for rmd_doc
update(object, ...)

Arguments

object

An object of class rmd_doc.

...

Named arguments to be inserted in the YAML header (passed to write_rmd()).

Examples

Run this code
## Create a document from a list
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")
my_document

## Change output format
my_document <- update(my_document, output = "pdf_document")
my_document

Run the code above in your browser using DataLab