help_console: Return the text of a help file as a string

Description Usage Arguments Details Examples

View source: R/help.R

Description

This function returns the contents of an R help file to the console as a character vector, printing it for easy reading. It is intended for dynamic documents where you want to show part of a help file in the course of a tutorial. For this usage, you may wish to temporarily assign help_console to help using non-printed code chunk.

Usage

1
2
help_console(topic, format = c("text", "html", "latex", "Rd"),
  lines = NULL, before = NULL, after = NULL)

Arguments

topic

The help topic, quoted or not

format

the format of the help topic. HTML and latex may be useful when creating documents of this type, in which case the output should be written "as is" rather than in a code or verbatim environment

lines

Optional. An integer vector specifying which lines to print

before, after

Text to insert before or after the help file, such as <quote> and </quote> for printing the text as quoted HTML

Details

This function uses non-exported functions in the tools package, so it may not work with future updates.

Found at https://www.r-bloggers.com/printing-r-help-files-in-the-console-or-in-knitr-documents/

Examples

1
2
3
help_console(c)
txt <- help_console(c)
help_console(optim, "html", lines=1:25, before="<quote>", after="</quote>")

rpruim/rjp documentation built on Aug. 14, 2019, 9:52 p.m.