helpExtract: Extract Portions from R Help Files for Use in Documents

View source: R/helpExtract.R

helpExtractR Documentation

Extract Portions from R Help Files for Use in Documents

Description

Extracts specified portions of R help files for use in Sweave or R-markdown documents.

Usage

helpExtract(Function, section = "Usage", type = "m_code", ...)

Arguments

Function

The function that you are extracting the help file from.

section

The section you want to extract. Defaults to "Usage".

type

The type of character vector you want returned. Defaults to "m_code". See Details

...

Other arguments passed to getHelpFile.

Details

The type argument accepts:

  • "m_code": For use with markdown documents in instances where highlighted code is expected, for example the "Usage" section.

  • "m_text": For use with markdown documents in instances where regular text is expected, for example the "Description" section.

  • "s_code": For use with Sweave documents in instances where highlighted code is expected, for example the "Usage" section.

  • "s_text": For use with Sweave documents in instances where regular text is expected, for example the "Description" section.

To insert a chunk into a markdown document, use something like:

⁠```{r, echo=FALSE, results='asis'}⁠ ⁠cat(helpExtract(cor), sep = "\n")⁠ ⁠```⁠

To insert a chunk into a Sweave document, use something like:

⁠\Sexpr{knit_child(textConnection(helpExtract(cor, type = "s_code")), options = list(tidy = FALSE, eval = FALSE))}⁠

Value

A character vector to be used in a Sweave or R-markdown document.

Note

Reproduced here with helper functions defined from R source, so there are no ::: calls.

Author(s)

Ananda Mahto (https://github.com/mrdwab/SOfun)


homerhanumat/bcscr documentation built on Dec. 18, 2024, 9:29 a.m.