Loading Events

« All Events

  • This event has passed.

Lessons Learned Writing R Packages (Davis-R Users Group)

November 14, 2019 @ 11:00 am - 1:00 pm

This week’s Davis R Users’ Group meetup features a guest presentation on…

Lessons Learned in Writing R Packages
by Will Hemstrom, UC Davis Evolution and Ecology


I used to have an R script. It was a big script, and it represented months of code. Function, followed by function, followed by function. Then, I made a mistake. I came back two months later and tried to figure out what one of those functions did. Big mistake. Clearly, the coder who wrote that function was a moron who didn’t bother to document anything. I sighed, sourced, and spent an hour trying to figure out how to use my own code. Then, I looked for a solution.

A big part of what makes R a useful data analysis environment is the availability of a huge range of packages that allow for the use of an immense variety of different methods and data types. Writing your own R package allows you to integrate function documentation into R’s help utilities (tab completion! help() functions!), organize your code, and share easy-to-use sets of tools with others or with your grateful future self. In this presentation, we’ll go over package creation, structure, and organization. Basic knowledge of function writing is useful but not required!

Please come with the devtools, usethis, and roxygen 2 packages installed! On Windows, this will require Rtools; on mac, this will require Xcode; on Linux, this will require black magic (you’ll have to google your particular distribution for help).

After the presentation D-RUG will have its general open drop in help


November 14, 2019
11:00 am - 1:00 pm


Shields Library, room 360


DataLab: Data Science and Informatics (DSI)