/pkgpeanuts

Automate robust R package scaffolding setup.

Primary LanguageROtherNOASSERTION

pkgpeanuts

Author: Matthew Leonawicz gitter
License: MIT

Travis-CI Build Status AppVeyor Build Status Coverage Status

The intent of pkgpeanuts is to automate building out robust R package scaffolding for a newly created package. Create a new R package project with git in RStudio. Then let pkgpeanuts take care of the rest.

This package is in early development. It is not intended for operating on existing, developed packages; only new packages as newly created RStudio projects. It also does not work yet for creating new packages itself (difficulties with git and Windows), hence the instruction about creating a new project in RStudio first. Use at your own risk and/or read the source code.

Installation

You can install the development version of pkgpeanuts from GitHub with:

# install.packages("remotes")
remotes::install_github("leonawicz/pkgpeanuts")

Package setup

After creating a new local package project with git in RStudio, call pkgpeanuts::pour from the package root directory with your desired arguments. I suggest not doing this, however. Instead, use the convenient RStudio addin.

pkgpeanuts has many arguments. See the help documentation for details. And again, this is not intended for existing packages.

Special notes

This is relevant particularly for Windows users. I have not tested on other systems.

  • Must be in a new, local package project (using git) created in RStudio
  • Corresponding remote repository must not yet exist on GitHub (create remote repo error)
  • .Renviron must contain a valid GITHUB_PAT entry
  • For the time being, the addin (but not the pour function itself), will do the following:
cred <- git2r::cred_ssh_key(publickey = "~/../.ssh/id_rsa.pub", privatekey = "~/../.ssh/id_rsa")
usethis::use_github(credentials = cred)

This is the only way I currently have things functioning without errors.

Motivation

The primary motivation is for the convenient RStudio addin.

At each of my last two workplaces I have created workplace context-specific renditions of this package. This has enabled me to spin up new packages at work quickly and still have them conforming to professional standards and looking polished, despite limited time. By avoiding manually fussing with extraneous details that can be automated, I can focus on the fun part: building out the core package content. pkgpeanuts represents a generalization of my previous packages, stripping away code related to specific contexts. By design it must try to achieve less than my other packages did, but if generalized appropriately, could be useful to the R community.

This is largely a wrapper around a plethora of usethis functions, plus additional functions from pkgpeanuts. usethis has also received a number of significant developments recently, which has led to some new simplifications of things I no longer need to do myself when making packages.