examplePage: Create an html Page Showing All Examples in Rd Files

View source: R/examplePage.R

examplePageR Documentation

Create an html Page Showing All Examples in Rd Files

Description

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.

Usage

examplePage(
  pkg = getwd(),
  openChunk = "```{r, message=FALSE, warning = FALSE, error = FALSE}",
  includeDontshow = FALSE,
  includeDontrun = FALSE,
  exclude = NULL
)

Arguments

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 Dontshow sections of the Rd file.

includeDontrun

Logical indicating whether to include the Dontrun sections of the Rd file.

exclude

Character vector listing the Rd files to skip. For instance, c("func1.Rd", "func2.Rd").

Value

Creates and displays a web page.

Note

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.

Author(s)

Bryan A. Hanson, DePauw University. hanson@depauw.edu

References

sachaepskamp.com/blog/HTMLexamples

Examples


## Not run: 
examplePage(getwd())

## End(Not run)



bryanhanson/HandyStuff documentation built on July 22, 2022, 6:18 a.m.