Package Development in R

This guide walks through the process of developing an R package
Authors

Asher Spector

Simo Goshev

Steve Worthington

Jinjie Liu

Published

September 4, 2026

Introduction

Table of Contents

This guide is organized into three parts.

  1. First, we’ll run through The proper way to structure and test packages.
  2. Second, we’ll discuss Version Control with Git and GitHub
  3. Lastly, we’ll briefly look at a couple of IDEs, which are just pieces of software that make it easier to write packages.

Here’s a link to a great devtools cheatsheet which puts most of the useful commands in this guide in one place.

We also wrote a small development example package (called devex) which you can find linked here, on GitHub. If you haven’t used GitHub yet, don’t worry - we’ll go over how to use GitHub later.

Also, this guide is still under development, and we take feedback! If you find anything confusing or think the guide misses important content, please email help@iq.harvard.edu

Authors and Sources

Asher Spector at Harvard College wrote the tutorial and set up its repository and website; Simo Goshev and Steve Worthington at IQSS designed its structure and edited it, and Jinjie Liu polished the content. This guide was written for a different audience, but a lot of its structure and content is based on Hadley Wickham’s book R Packages. To help write the sections on testing, we also referenced Christopher Gandrud’s ‘Failing Faster’ Presentation, and Christopher Gandrud’s Broader Testing Guidelines. For the section on on Version Control, we referenced Karl Broman’s Book, a Git-Tower post, and the GitHub documentation here and here to help write this guide.