This article describes how to use the template for a new package. The Overview section presents a recipe that leads to a fully configure package. The rest of the sections illustrate some of the steps. For more general information about R package development, refer to (Wickham 2015).

Overview

The following steps set up:

  • Essential configurations for deploying an R package locally and on GitHub; and
  • Information about the package and the development team.

To use the template for a new package, follow the next steps:

  1. Choose a package name:
  • Do use the following characters: letters (uppercase or uppercase), digits and dot (“.”); and
  • Don’t use spaces, underscores or hyphens. Instead, use camelCase or dots to separate words.
  1. Create a new repo on GitHub; name the repo after the package name;
  2. Copy the content of template.package into the new repo;
  3. Delete the vignettes folder;
  4. Rename template.package.Rproj to {package-name}.Rproj;
  5. Update the following fields within the DESCRIPTION file:
  • Package; rename the package name.
  • Title; describe the package in one line:
    • It should be plain text (no markup), capitalised like a title, and NOT end in a period; and
    • Keep it short: listings truncate the title to 65 characters.
  • URL; Add a link pointing at the GitHub pages address of the package:
  • BugReports; edit the URL such that it leads to the package issue page:
  • Date; replace with the creation date of the package:
    • The specified date determines the MRAN snapshot date; alternatively
    • Use the most recent packages on CRAN by removing that filed.
  • Authors and Maintainer: Update persons information;
  • Description; Elaborate the package Title:
    • You can use multiple sentences but you are limited to one paragrap; and
    • If your description spans multiple lines (and it should!), each line must be no more than 80 characters wide. Indent subsequent lines with 4 spaces
  1. Render the README.Rmd file. By default, README.Rmd displays package information gathered from the DESCRIPTION file;
  2. Push changes to GitHub;
  3. Connect the GitHub repo to external services:
  • Go to GitHub user Settings/Developer settings/Personal access tokens and generate a token named GITHUB_PAT; then
  • Go to Travis website, add the project and enable its integration. Add GITHUB_PAT as an environment variable; then
  • Go to Codecov website, add the project and enable its integration.

References

Wickham, Hadley. 2015. R Packages: Organize, Test, Document, and Share Your Code. http://r-pkgs.had.co.nz/; " O’Reilly Media, Inc.".