pax Follow

Project Status: Active - The project has reached a stable, usable
state and is being actively
developed. Build
Status Coverage
Status DOI Version

A gold version R package template.

pax Logo

Table of Contents


pax is a package template system that is NOT designed to be light weight. It is the deluxe, gold version of a package template. pax enforces a fairly narrow package management philosophy. It expects the user will utilize:

  1. GitHub for repository sharing
  2. RStudio for GUI
  3. testthat for unit testing
  4. Coveralls + covr for code coverage rating
  5. devtools/roxygen2 for documentation
  6. knitr for README management

pax has one main function that does one job. pax (package and function named pax) creates a package template. It allows the user to specify construction arguments (locally or via options in .Rprofile). Arguments that can be set in the .Rprofile include:

Argument Description Example name The user's name (first & last) options(name = c(first="Tyler", last="Rinker")) email The user's email address options(email = "[email protected]") license The package license options(license = "GPL-2") github.user The user's GitHub name options(github.user = "trinker") samples Logical; if TRUE, sample .R & test-.R added options(samples = FALSE) tweak A function or path/url to a user specified 'tweaking' function* options(tweak = "")

*Note: See ?pax for more information about the tweak argument; CLICK HERE for an example.

These arguments can be quickly added by using the pax_options function. This generates the following blank script that can be added to the user's .Rprofile:

options(name = c(first = "",  last = ""))
options(email = "")
options(license = "")
options(github.user = "")
options(samples = )
options(tweak = "")
options(dir = "") ## See `?ploc` for details


The standard pax template looks like:

|   .gitignore
|   .Rbuildignore
|   foo.rproj
|   NEWS
|   README.Rmd
|   travis.yml
|       maintenance.R
|       foo-package.R
|       sample.R
|       utils.R
    |   testthat.R


To download the development version of pax:

Download the zip ball or tar ball, decompress and run R CMD INSTALL on it, or use the pacman package to install the development version:

if (!require("pacman")) install.packages("pacman")

Additional Features

Function Description new_r Makes roxygen2 style .R template file from a function or character string new_test Makes testthat style unit test template file from a function or character string new_r_test Makes roxygen2 style .R and testthat style unit test files from a function or character string new_data Adds data & appends roxygen2 style template to package description .R file new_vignette Makes rmarkdown style .Rmd vignette template file

In addition to the pax templating function, pax also has a few additional tools to generate .R and test-____.R scripts that add a roxygen2 style .R file to the R directory as well as adding a testthat style unit test file to tests/testthat directory. These actions can be done separately but it is recommended that they be combined into one function call: new_r_test. This sets a test-driven development expectation that as a function is created a unit test is used in the development process.

The new_data enables the user to add a data set to the data directory and append the roxygen2 style .R markup template to the package's description file (R/____-package.R). The new_vignette function provides a means of quickly adding an rmarkdown with the appropriate title field and \VignetteIndexEntry set.


Additional Package Development Resources


You are welcome to: - submit suggestions and bug-reports at: - send a pull request on: - compose a friendly e-mail to: [email protected]

trinker/pax documentation built on Feb. 24, 2018, 2:13 a.m.