Learn R Programming

parsermd (version 0.1.3)

rmd_source: Source the code chunks of an Rmd document

Description

This is the equivalent of the source() function for Rmd files or their resulting asts.

Usage

rmd_source(x, local = FALSE, ..., label_comment = TRUE, use_eval = TRUE)

Value

Returns the result of source() for any R code chunks.

Arguments

x

An Rmd document (e.g. rmd_ast, rmd_tibble, Rmd file path, etc.)

local

TRUE, FALSE or an environment, determining where the parsed expressions are evaluated. FALSE (the default) corresponds to the user's workspace (the global environment) and TRUE to the environment from which source is called.

...

Additional arguments passed to source.

label_comment

Attach chunk labels as comment before each code block.

use_eval

Use the eval chunk option to determine if code is included.

Examples

Run this code

rmd_source(system.file("minimal.Rmd", package = "parsermd"), echo=TRUE)

Run the code above in your browser using DataLab