tpl_subheading: Returns a character vector for the code chunk to insert a...

View source: R/chunk_templates.R

tpl_subheadingR Documentation

Returns a character vector for the code chunk to insert a subheading

Description

Returns a character vector for the code chunk to insert a subheading

Usage

tpl_subheading(chunk_label, subheading, level = 2L)

Arguments

chunk_label

Character, chunk label

subheading

Character, subheading text

level

Integer, level of the heading, defaults to 2L

Value

List of character vectors with chunk texts

Examples

# Returns code chunk as list
code_chunk_list <- tpl_subheading(
  chunk_label = 1L,
  subheading = "Subsection 1"
)

# Unlist
code_chunk_vector <- unlist(
  code_chunk_list
)

# Display code chunks as they will be written to the Rmd
writeLines(
  code_chunk_vector
)

# The function is vectorized, so you can do this:
tpl_subheading(
  chunk_label = c(
    1L,
    2L
  ),
  subheading = c(
    "Subsection 1",
    "Subsection 2"
  )
)

RichardMeyer-Eppler/RUBer documentation built on June 2, 2022, 7:24 p.m.