examplePage | R Documentation |
This function runs all the example code in a package's Rd files, using
knitr
to create a markdown
file. This file is then converted
to html and opened in a browser. This function was written by Sasha Epskamp
and published on his blog (sachaepskamp.com/blog/HTMLexamples). I modified
it to accept more than one file for exclude
, to present the
examples in alphabetical order, and to use the global environment during kniting.
examplePage( pkg = getwd(), openChunk = "```{r, message=FALSE, warning = FALSE, error = FALSE}", includeDontshow = FALSE, includeDontrun = FALSE, exclude = NULL )
pkg |
Path to the package directory. |
openChunk |
Character. The default opening markdown chunk. Defaults to the current working directory. |
includeDontshow |
Logical indicating whether to include the
|
includeDontrun |
Logical indicating whether to include the
|
exclude |
Character vector listing the Rd files to skip. For instance,
|
Creates and displays a web page.
Formatting the Rd examples with ### results in a large header. Using ## results in a small header. This function creates a temporary directory for the .Rmd, .md and .html files, which is then deleted at the end of the R session.
Bryan A. Hanson, DePauw University. hanson@depauw.edu
sachaepskamp.com/blog/HTMLexamples
## Not run: examplePage(getwd()) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.