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:
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 = "tyler.rinker@gmail.com") |
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 = "http://goo.gl/oL7UXO") |
*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 = "")
The standard pax template looks like:
| .gitignore
| .Rbuildignore
| DESCRIPTION
| foo.rproj
| NEWS
| README.md
| README.Rmd
| travis.yml
|
+---inst
| maintenance.R
|
+---R
| sample.R
| utils.R
|
\---tests
| testthat.R
|
\---testthat
test-sample.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")
pacman::p_load_gh("trinker/pax")
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_vignette
proides a means of quickly adding an rmarkdown with the appropriate title
field and \VignetteIndexEntry
set.
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_vignette |
Makes rmarkdown style .Rmd vignette template file |
You are welcome to:
Functions for constructing package and file templates.
pax
(package-pax, pax-package)new_r_test
new_r
new_test
new_vignette
Functions intended for internal or general use.
is.global
pax_options
ploc