GetExampleText {BrailleR}R Documentation

extract the example text from a help page


A cut back version of example() for obtaining the text used in examples on help pages without running those examples. The function is intended to help write markdown/Sweave documents.


GetExampleText(topic, package = NULL, lib.loc = NULL, character.only = FALSE, outFile="")



name or literal character string: the online help topic the examples of which should be run.


a character vector giving the package names to look into for the topic, or NULL (the default), when all packages on the search path are used.


a character vector of directory names of R libraries, or NULL. The default value of NULL corresponds to all libraries currently known. If the default is used, the loaded packages are searched before the libraries.


a logical indicating whether topic can be assumed to be a character string.


an optional filename to save the results into. The default is to use a temporary file.


The example() code was hacked back to form this utility function. It is probably a little heavy for what is needed but it works sufficiently at the time of creation.


a vector of character strings each element being one line of the examples from the corresponding help topic.


The work of Martin Maechler and others got tampered with by A. Jonathan R. Godfrey

See Also

You may wish to compare this with example


cat(paste(GetExampleText(mean), collapse="\n"))

[Package BrailleR version 0.32.1 Index]