---
title: "runExamplesWrapper"
author: Barry Zeeberg [aut, cre]
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{runExamplesWrapper}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

<style>
body {
text-align: justify;
font-size: 16pt;
font-family: Times;}
</style>

<p class=MsoNormal align=center style='text-align:center'><b style='mso-bidi-font-weight:
normal'><span style='font-size:16.0pt;font-family:"Times New Roman",serif;
color:red'>Wrapper for *run_examplez()*<br>
Capture and Archive Errors in Package Examples<o:p></o:p></span></b></p>

<p class=MsoNormal align=center style='text-align:center'><b style='mso-bidi-font-weight:
normal'><span style='font-size:16.0pt;font-family:"Times New Roman",serif'><o:p>&nbsp;</o:p></span></b></p>

<p class=MsoNormal align=center style='text-align:center'><b style='mso-bidi-font-weight:
normal'><span style='font-size:16.0pt;font-family:"Times New Roman",serif'><o:p>&nbsp;</o:p></span></b></p>

<p class=MsoNormal align=center style='text-align:center'><b style='mso-bidi-font-weight:
normal'><span style='font-size:16.0pt;font-family:"Times New Roman",serif'>Barry
Zeeberg<o:p></o:p></span></b></p>

<p class=MsoNormal align=center style='text-align:center'><b style='mso-bidi-font-weight:
normal'><span style='font-size:16.0pt;font-family:"Times New Roman",serif'>barryz2013@gmail.com<o:p></o:p></span></b></p><br>

<p class=MsoNormal style='text-align:justify'><span style='font-size:16.0pt;
font-family:"Times New Roman",serif'></p><br>

<p class=MsoNormal align=center style='text-align:center'><b style='mso-bidi-font-weight:
normal'><span style='font-size:16.0pt;font-family:"Times New Roman",serif'>Motivation<o:p></o:p></span></b></p>


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).
<br>

![Figure 1. Result of running *x<-runExamplesWrapper(getwd())* for upcoming package *cardUtils*.](Figure1.jpg){width=150%}

<br>
*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.



