Package List    GitHub Project Page

the cloudyr project

make R cloudier!

the cloudyr project uses a standardized style package structure and programming style to streamline development, facilitate any future package maintenance, and ease contributions from new users. This document describes the essential features of a cloudyr package. A template package is available, which provides a skeleton that complies with this guide.

package structure

cloudyr packages should follow the guidelines describe in Writing R Extensions and adopt a standard package structure:

+-- /data
+-- /inst
|   +-- CITATION
+-- /man
+-- /R
|   +-- *.R
+-- /tests
|   +-- /testthat
|   +-- test-all.R
+-- /vignettes
+-- .gitignore
+-- .Rbuildignore
+-- .travis.yml
+-- NEWS

The /man directory is generated automatically by roxygen2 (via devtools::document()). This directory will contain all function documentation plus a package-level documentation page accessible via ? packagename. R code files in the /R directory should have capital .R extensions and be written using complete roxygen2 markup (see below). A /tests directory contains relevant testthat testing code.

Optional directories include /data for embedded package data and /vignettes can be used to store knitr-enabled vignettes where appropriate.

The following sections describe some of these files in detail.


All cloudyr packages must have a CITATION file of the following form:

citHeader("To cite package 'aws.signature' in publications use:")
 year <- sub(".*(2[[:digit:]]{3})-.*", "\\1", meta$Date, perl = TRUE)
 vers <- paste("R package version", meta$Version)
          title = "aws.signature: Amazon Web Services Request Signatures",
          author = personList(as.person("Thomas J. Leeper")),
          year = year,
          note = vers,
          textVersion =
          paste("Thomas J. Leeper (",
                "). aws.signature: Amazon Web Services Request Signatures. ",
                vers, ".", sep=""))


All package documentation should be generated dynamically with roxygen2 (via devtools::document()). The NAMESPACE file is generated automatically, as well. Some key features of high quality documentation include:

  1. Packages should have a package-level documentation page (i.e., accessible via the package name, such as ? aws.s3, from the R console).
  2. Cross-references between help files should be used generously. This includes cross-references to other packages’ functions (using the \code{\link[pkgname]{function}} markup).
  3. Related functions should be documented together by using the #' @rdname tag, where appropriate.
  4. Documentation should use #' @details, #' @references, and #' @examples as much as needed to fully convey relevant details of code. Verbosity is virtue!
  5. Vignettes should be used as needed, but are not required. Thematic documentation pages can also be included in addition to function-specific documentation pages (see ? regex for an example of this).


Code should be written cleanly, using roxygen2 inline documentation, comments where appropriate, and in a manner consistent with the Google R Style Guide and Hadley’s guide. A few key points:

For packages that interact with remote websites:

.gitignore and .Rbuildignore

A .gitignore may be needed to mask files in a directory. A .Rbuildignore should cover all non-standard files in the top-level directory:


continuous integration

All cloudyr packages are tested automatically on the Travis-CI Continuous Integration service. A reasonable .travis.yml file would look like the following:

language: r
sudo: required
- covr
- drat
- Rscript -e 'library(covr);codecov()'
- test $TRAVIS_PULL_REQUEST == "false" && test $TRAVIS_BRANCH == "master" && bash
  - secure: jw8SjbwUlKz/zPczyqcvnm0r9jbUvNb4hplUn3bxlD2SniNkitqODk2/jmlfunrpmHJRS4GDx6X6omYTNwvNsyE51dK6XJE8nZuaeCPvGLl3xxgRL6dis2JGwy2itRm0C/P6UEAUSmuTbtR15N1JC7Y7ot0IRpfRZc0tOkuS8L0=

This indicates the use of native R support, which requires sudo permissions. r_github_packages should be used to install working versions of packages where appropriate.

Packages should have (testthat) tests and should push code coverage results to the cloudyr page using the covr package.

The travisci package should be used, where needed, to automatically trigger builds of dependent cloudyr packages using:

- Rscript -e "travisci::restart_last_build('cloudyr/dependentpkg')"

This requires an encrypted TRAVIS_CI_TOKEN environment variable.


All packages, conditional on passing CI tests, are automatically posted to the cloudyr drat repository, so that they can be installed using install.packages() in addition to install_github() (from ghit or devtools). The file achieves this:

set -o errexit -o nounset
  mkdir drat; cd drat

  ## Set up Repo parameters
  git init
  git config "leeper"
  git config ""
  git config --global push.default simple

  ## Get drat repo
  git remote add upstream "https://$"
  git fetch upstream
  git checkout master

  Rscript -e "drat::insertPackage('../$PKG_TARBALL', repodir = './drat')"
  git add --all
  git commit -m "add $PKG_TARBALL (build $TRAVIS_BUILD_ID)"
  git push


For this code to execute successfully, a GH_TOKEN environment variables needs to be encrypted in the repo.

A file should be written in markdown and include a reference to this page. Here’s a template:

Contributions to **aws.s3** are welcome from anyone and are best sent as pull requests on [the GitHub repository]( This page provides some instructions to potential contributors about how to add to the package.

 1. Contributions can be submitted as [a pull request]( on GitHub by forking or cloning the [repo](, making changes and submitting the pull request.
 2. The cloudyr project follows [a consistent style guide]( across all of its packages. Please refer to this when editing package code.
 3. Pull requests should involve only one commit per substantive change. This means if you change multiple files (e.g., code and documentation), these changes should be committed together. If you don't know how to do this (e.g., you are making changes in the GitHub web interface) just submit anyway and the maintainer will clean things up.
 4. All contributions must be submitted consistent with the package license ([GPL-2](
 5. Non-trivial contributions need to be noted in the `Authors@R` field in the [DESCRIPTION]( Just follow the format of the existing entries to add your name (and, optionally, email address). Substantial contributions should also be noted in [`inst/CITATION`](
 6. The cloudyr project use royxgen code and documentation markup, so changes should be made to roxygen comments in the source code `.R` files. If changes are made, roxygen needs to be run. The easiest way to do this is a command line call to: `Rscript -e devtools::document()`. Please resolve any roxygen errors before submitting a pull request.
 7. Please run `R CMD BUILD aws.s3` and `R CMD CHECK aws.s3_VERSION.tar.gz` before submitting the pull request to check for any errors.
Some specific types of changes that you might make are:

 1. Bug fixes. Great!
 2. Documentation-only changes (e.g., to Rd files, README, vignettes). This is great! All contributions are welcome.
 3. New functionality. This is fine, but should be discussed on [the GitHub issues page]( before submitting a pull request.
 3. Changes requiring a new package dependency should also be discussed on [the GitHub issues page]( before submitting a pull request.
 4. Message translations. These are very appreciated! The format is a pain, but if you're doing this I'm assuming you're already familiar with it.

Any questions you have can be opened as GitHub issues or directed to thosjleeper (at)


There is not much to say about DESCRIPTION beyond that described in Writing R Extensions. However, a few points:


A NEWS files should be present and be used to store three types of information:

  1. Documentation changes
  2. Bug fixes
  3. Significant user-visible changes (such as API changes)

This does not need to be updated on every commit, but rather on significant changes. Changes that address GitHub issues should mention the issue number and other changes should attribute code authors or bug reporters where appropriate:

# CHANGES TO aws.signature v0.1.1 #

 * Fixed header encoding error. (#1, h/t Thomas Leeper)


A file should be included to display on GitHub and CRAN. This should provide a package description, installation instructions, and brief code examples. This can be generated from a README.Rmd file using knitr::knit("README.Rmd"), but it is not required.

The README should contain the cloudyr project footer with a link to the cloudyr project page.

[![cloudyr project logo](](

programming style

A few rules about programming style:

  1. Commits are cheap and should be used frequently.
  2. Commit messages should reference issue numbers and close issues explicitly (e.g., fix headers (closes #1)) where appropriate.
  3. Pull requests on GitHub should be merged on the command line, not using the web interface, if possible, or via the web interface without a merge commit.