A workshop at The UNM Dept of Math & Stats on Friday 8/17/2018 10AM-5PM in SMLC 356.


This is like a “hack-a-thon”, but, instead of tackling a dataset analysis, the goal is to learn and use the skills to package R code. The first hour or so will cover the basic ideas of packaging code using modern tools such as RStudio, devtools, usethis, and git. The rest of the day is intended as a protected time where you can turn your code into a package. We’ll cover the basics of creating a package, package testing, writing vignettes, and using github (and CRAN) for version control and making your package available.

To get the most out of this workshop, bring a package idea to start on. A few ideas:

  1. If you already have a set of functions that you load with script(“my_functions.R”), then you’re an afternoon away from making a great package.
  2. If you have a large script with repeated code, then you can start by turning the repeated code into functions, package those functions, and write a short vignette to perform the same analysis using your package.
  3. If you have an idea for a new package to develop, bring that idea with you and we can consider trying to develop it during the workshop.


Purpose of the Hack-a-Pack

The main goal of this event is to transform existing code into R packages for your personal use and that can be made available to the statistics community. Whether you have existing code that you want to make into a package, or want to help others make and document packages, you are welcome to participate!


At the beginning of the Hack-a-Pack, please complete the following steps.

  1. Download/update R to the release version (3.5.1) (https://cran.r-project.org/)
  1. Download/update RStudio (https://www.rstudio.com/products/rstudio/download2/#download)
  2. Install Rtools (only required for Windows, https://cran.r-project.org/bin/windows/Rtools/)
  3. Create a GitHub Account: (https://github.com/)
  4. If you have code you want to develop into a package during the Hack-a-Pack: Create 1 slide describing the project/code and current status of the package (e.g., one long script, functions, shared on Github, etc.). Otherwise, add your name to the Participants slide and to any projects you might be interested in contributing to. (https://tinyurl.com/RHackaPack2018Pres)

At a Glance

Prior to the Hack-a-Pack, participants were invited to contribute to a slide of “project pitches,” which were then presented by their proposer. Two talks by the organizers focus on stages of R package development and collaboration with git. Teams will form around projects formed from the pitches and teams will begin their work. After several hours of open hacking, each team will give a presentation of their progress to the rest of the Hack-a-Pack and will solicit input, especially regarding stumbling blocks they’d encountering. It is common for these intermediate reports to help refocus the project and help stay on track to reach a fruitful conclusion by the end of the Hack-a-Pack.

Hack-a-Pack Schedule

All activities are in SMLC 356.

Time Event
10:00 AM Introduction to Hack-a-Pack, schedule
10:20 AM Project proposals, participants, skills
10:30 AM R Package basics
11:30 AM Git and SourceTree basics
12:00 PM Lunch
12:45 PM Projects and Team organization
1:00 PM Open hacking
3:00 PM Mid-hack project updates
3:20 PM Open hacking
4:45 PM Briefings
5:00 PM Beers

Mid-hack project updates

  • Brief updates on project progress & challenges
  • Teams solicit feedback & suggestions
  • Prompted discussion of general issues with developing and using R packages

Example Projects

  • Developing existing code into an R package and upload to github
  • Put your existing github R package onto CRAN
  • Translate code from another language to R
  • Package datasets for a textbook or other collection
  • Improve documentation of an existing R packages by developing vignettes, blog posts, or just improving the official documentation (via a github pull request)
  • Initiating a statistical software paper for later submission to Journal of Statistical Software, F1000, the R Journal, etc.

In order to be accepted to CRAN the package must pass R CMD check and should also contain a vignette describing how to use the package. This is a generally good standard, regardless.

Projects and Participants


If you’d like to lead a project, create one slide. The slide should contain (1) a title and your name, (2) a brief description of the method your code implements, (3) the current status of your package (e.g. one long script, a set of functions, on Github, etc.), and (4) your goal for the Hack-a-Pack (e.g., create a GitHub package, get a package on CRAN, write a vignette, start a statistical software paper).

If you’d like to participate in a project, check out the list of project slides. Add your name to the notes area of the slide for the project(s) that interest you. (This is just to gauge interest — you can always switch between teams during the Hack-a-Pack and can add your name to multiple projects.) You can also list your skills on the skills slide.

Participants & Skills

If you don’t wish to lead a project but have skills that could be helpful for teams, add your name and any relevant skills to the Participants & Skills slide.

Asking and answering questions, sharing wisdom


Add the note here, refer to this page throughout the workshop for updates.

R package basics

Erik Erhardt

R package development basics.

This brief tutorial is intended to run through the initial steps to creating the package structure, writing documented functions, handling the package description and namespace, including data, writing package vignettes, and creating attractive documentation.

Collaboration with Git and SourceTree

Adah Zhang


Version control is a critical tool to help organize and coordinate work between multiple contributors in the development of an R package.