Learn R Programming

noamtools (version 0.1)

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

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

help_console(topic, format = c("text", "html", "latex", "Rd"), lines = NULL, before = NULL, after = NULL, package = 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
package
A character string containing the package name to search. Necessary if two packages share a function name. and 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.

Examples

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

Run the code above in your browser using DataLab