library("pax")
desc <- suppressWarnings(readLines("DESCRIPTION"))
regex <- "(^Version:\\s+)(\\d+\\.\\d+\\.\\d+)"
loc <- grep(regex, desc)
ver <- gsub(regex, "\\2", desc[loc])
verbad <- sprintf('<a href="https://img.shields.io/badge/Version-%s-orange.svg"><img src="https://img.shields.io/badge/Version-%s-orange.svg" alt="Version"/></a></p>', ver, ver)
````

```r
library(knitr)
knit_hooks$set(htmlcap = function(before, options, envir) {
  if(!before) {
    paste('<p class="caption"><b><em>',options$htmlcap,"</em></b></p>",sep="")
    }
    })
knitr::opts_knit$set(self.contained = TRUE, cache = FALSE)
knitr::opts_chunk$set(fig.path = "tools/figure/")

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

A gold version R package template.

pax Logo

Description

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 = "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:

pax_options()

Template

The standard pax template looks like:

|   .gitignore
|   .Rbuildignore
|   DESCRIPTION
|   foo.rproj
|   NEWS
|   README.md
|   README.Rmd
|   travis.yml
|   
+---inst
|       maintenance.R
|       
+---R
|       foo-package.R
|       sample.R
|       utils.R
|       
\---tests
    |   testthat.R
    |   
    \---testthat
            test-sample.R

Installation

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_current_gh("trinker/pax")

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.

Help

Additional Package Development Resources

Contact

You are welcome to: submit suggestions and bug-reports at: https://github.com/trinker/pax/issues send a pull request on: https://github.com/trinker/pax/ * compose a friendly e-mail to: tyler.rinker@gmail.com



trinker/pax documentation built on May 31, 2019, 9:42 p.m.