Learn R Programming

parsermd (version 0.1.3)

rmd_node: rmd node utility functions

Description

Functions for extracting information for Rmd nodes.

Usage

rmd_node_label(x, ...)

rmd_node_type(x, ...)

rmd_node_length(x, ...)

rmd_node_content(x, ...)

rmd_node_attr(x, attr, ...)

rmd_node_engine(x, ...)

rmd_node_options(x, ...)

rmd_node_code(x, ...)

Value

  • rmd_node_label() - returns a character vector of node labels, nodes without labels return NA.

  • rmd_node_type() - returns a character vector of node types.

  • rmd_node_length() - returns an integer vector of node lengths (i.e. lines of code, lines of text, etc.), nodes without a length return NA.

  • rmd_node_content() - returns a character vector of node textual content, nodes without content return NA.

  • rmd_node_attr() - returns a list of node attribute values.

  • rmd_node_engine() - returns a character vector of chunk engines, NA for all other node types.

  • rmd_node_options() - returns a list of chunk node options (named list), MULL for all other node types.

  • rmd_node_code() - returns a list of chunk node code (character vector), NULL for all other node types.

Arguments

x

An rmd object, e.g. rmd_ast or rmd_tibble.

...

Unused, for extensibility.

attr

Attribute name to extract.

Examples

Run this code

rmd = parse_rmd(system.file("hw01.Rmd", package="parsermd"))

rmd_node_label(rmd)
rmd_node_type(rmd)
rmd_node_content(rmd)
rmd_node_attr(rmd, "level")
rmd_node_engine(rmd)
rmd_node_options(rmd)
rmd_node_code(rmd)

Run the code above in your browser using DataLab