runExamplesWrapper

Barry Zeeberg [aut, cre]

2026-08-27

Wrapper for run_examplez()
Capture and Archive Errors in Package Examples

 

 

Barry Zeeberg



Motivation

The function run_example() within the pkgload package allows execution of the examples within a given man .Rd file. However, a major inconvenience is that the user needs to run each man .Rd file one at a time. Also, there is not a systematic record of the results, namely which package functions had no examples, which had examples that failed, and which had examples that succeeded.

The goal of the current package runExamplesWrapper is to provide the missing functionality.

The overall strategy involves two major steps:

My modified version run_example(), namely run_examplez(), has more informative return values that designate the status of executing the man .Rd example (“GOOD”, “BAD”,or “MIA”)

In addition, run_examplez() within a loop that executes run_examplez() enclosed in a tryCatch() statement and archives the return status

The return value is a vector specifying each function example as either “GOOD”, “BAD”, or “MIA” (Figure 1).

Figure 1. Result of running x<-runExamplesWrapper(getwd()) for upcoming package cardUtils.
Figure 1. Result of running x<-runExamplesWrapper(getwd()) for upcoming package cardUtils.


RunExamples() is used in conjunction with my upcoming (expected in Fall 2026) package retrieveFunctionsExamples to provide the information on which package function examples are still missing or incorrect, and need to be supplied. That package simplifies and partially automates management of manual page examples in multi-package projects.