pax: 'pax': A Gold Version Package Template

Description Usage Arguments Examples

View source: R/pax.R

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** is not flexible, rather it maintains and enforces a narrow package management philosophy.

This function creates a package template. It utilizes a framework with defaults that expects the user to use testthat, Travis-CI and covr (coveralls) to maintain the package. This is not a light weight template, but a deluxe template.

Usage

1
2
3
4
5
pax(path, name = getOption("name"), email = getOption("email"),
  license = getOption("license"), open = is.global(2), news = TRUE,
  readme = TRUE, rstudio = TRUE, gitignore = TRUE, testthat = TRUE,
  travis = TRUE, coverage = TRUE, github.user = getOption("github.user"),
  samples = getOption("samples"), tweak = getOption("tweak"), ...)

Arguments

path

location to create new regular expression library package. The last component of the path will be used as the package name.

name

A named vector that minimally contains the user's first and last name (e.g., c(first="Tyler", last="Rinker"))). This can be set in the user's options in the ‘.Rprofile’; for example:
options(name = c(first="Tyler", middle = "W.", last="Rinker")).

email

An email address to use for CRAN maintainer. This can be set in the user's options in the ‘.Rprofile’; for example:
options(email = "[email protected]").

license

A license to use in the ‘DESCRIPTION’ file (e.g., "GPL-2", "MIT"). This can be set in the user's options in the ‘.Rprofile’; for example:
options(license = "GPL-2").

open

logical. If TRUE the project will be opened in RStudio. The default is to test if new_report is being used in the global environment, if it is then the project directory will be opened.

news

logical. If TRUE a ‘NEWS’ file is generated.

readme

logical. If TRUE a ‘README.md’ file is generated.

rstudio

logical. If TRUE it is assumed RStudio will be used and a ‘xxx.proj’ file is generated.

gitignore

logical. If TRUE a ‘.gitignore’ file is generated.

testthat

logical. If TRUE it is assumed testthat will be used and a ‘test’ sub-folder with appropriate testthat subdirectories and files will be created.

travis

logical. If TRUE it is assumed Travis-CI will be used and a ‘travis.yml’ file is generated. For more on managing a ‘travis.yml’ with R see: https://github.com/craigcitro/r-travis.

coverage

logical. If TRUE it is assumed covr will be used. This information will be added to the ‘travis.yml’.

github.user

The user's GitHub user name. This can be set in the user's options in the ‘.Rprofile’; for example:
options(github.user = "trinker").

samples

logical. If TRUE a sample ‘.R’ regular expression file will be placed in the ‘R’ directory. Additionally, if testthat = TRUE, a sample ‘.R’ unit test will be placed in the ‘./tests/testthat’ directory. This can be set in the user's options in the ‘.Rprofile’; for example:
options(samples = TRUE).

tweak

Additional user supplied function that can be sourced at the end of the package creation. The following parameters are passed to your function automatically: (1) the package's name, (2) qpath (a function that binds together path pieces; the starting piece is supplied by the path argument, (3) name (vector of 2: first and last), (4) your email, (5) path, codeand (6) github.user. This can be argument can be set in the user's options in the ‘.Rprofile’; for example:
options(tweak = "C:/Users/Tyler/Copy/Public Scripts/augpax.R"). This argument can be a path to or url to a user specified 'tweaking' function. The user can also pass the function directly to tweak.

...

Other arguments passed to the user supplied tweak function.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
pax("DELETE_ME")

## Set a package location in .Rprofile and use `ploc` to conveniently 
## complete the full path to where the package should be created
##
options(dir = file.path(Sys.getenv("USERPROFILE"), "Desktop")) 
pax(ploc("DELETE_ME"))

## End(Not run)

trinker/pax documentation built on March 21, 2018, 3:01 a.m.