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:
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 = "") ## See `?ploc` for details
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
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")
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.
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.