Learn R Programming

rapport (version 0.3)

tpl.elem: Template Elements

Description

Returns a data.frame containing summary of relevant template elements: ind - indice of current element in template's body, type - a string indicating the type of the content ("heading", "inline" or "block"), and chunk - a string containing R expression found in a code chunk.

Usage

tpl.elem(fp,
    extract = c("all", "heading", "inline", "block"),
    use.body = FALSE, skip.blank.lines = TRUE,
    skip.r.comments = FALSE, ...)

Arguments

fp
a template file pointer (see tpl.find for details)
extract
a string indicating which elements should be extracted from the template: headings, blocks, or code chunks (by default it returns all of the above)
use.body
a logical value indicating whether the whole template should be used, or just its body
skip.blank.lines
remove blank lines within R chunks
skip.r.comments
remove comments withing R chunks
...
additional arguments to be passed to grep and get.tags functions

Value

  • a data.frame with 3 columns:

Examples

Run this code
fp <- system.file("templates", "example.tpl", package = "rapport")
    tpl.elem(fp) # returns all elements (headings, inlines and blocks)

    ## returns only code blocks
    tpl.elem(fp, extract = "block")

Run the code above in your browser using DataLab