Hadleyverse, R Packages, and Vignettes

Albert Y. Kim
Monday 2016/3/21

Hadley Wickham

Introducing Hadley Wickham, author of the Hadleyverse of packages (ggplot2, dplyr, lubridate, devtools) and countless other tools.

  • A priceonomics article on him.
  • He's also got a large Twitter following. Among my favorite tweets of his.

R Packages

One thing we won't be covering in this class is creating R packages: if you have

  • Data
  • Code
  • Analyses

that you want to share with the world, creating your own R package is the way to go.

R Packages

If you do want to learn how to write your own R packages, visit http://r-pkgs.had.co.nz/. You have all the tools to follow along.

Two example packages of mine:

  • resampledata: contains all the datasets from my MATH 311 Theory of Statistics class
  • SpatialEpi: Methods and Data for Spatial Epidemiology.

Vignette

Any good package is going to have a vignette. As Hadley Wickham describes them:

A vignette is a long-form guide to your package.

  • Function documentation is great if you know the name of the function you need, but it’s useless otherwise.
  • A vignette is like a book chapter or an academic paper: it can describe the problem that your package is designed to solve, and then show the reader how to solve it.

Examples

  • Type browseVignettes() in the console
  • Search for dplyr
  • Click on HTML for “Introduction to dplyr”“

Analogy

  • Help files are like instruction manuals: you don't read the whole thing; you read what you need, when you need it.
  • Vignettes are like get started guides: helps you get started and gives the executive summary.