Skip to content

Hadley Wickham: Pure, predictable, pipeable: creating fluent interfaces with R

Photo of Abhijit
Hosted By
Abhijit and 3 others
Hadley Wickham: Pure, predictable, pipeable: creating fluent interfaces with R

Details

For our September meetup we're honored to welcome Dr. Hadley Wickham (@hadleywickham), the author of several highly used packages in R, including dplyr, tidyr, stringr, devtools and ggplot2.

Abstract:
A fluent interface lets you easily express yourself in code. Over time a fluent interface retreats to your subconcious. You don't need to bring it to mind; the code just flows out of your fingers. I strive for this fluency in all the packages I write, and while I don't always succeed, I think I've learned some valuable lessons along the way.

In this talk, I'll discuss three guidelines that make it easier to develop fluent interfaces:

  • Pure functions. A pure function only interacts with the world through its inputs and outputs; it has no side-effects. Pure functions make great building blocks because they're are easy to reason about and can be easily composed.

  • Predictable interfaces. It's easier to learn a function if its consistent, because you can learn the behaviour of a whole group of functions at once. I'll highlight the benefits of predictability with some of my favourite R "WAT"s (including `c()`, `sapply()` and `sample()`).

  • Pipes. Pure predictable functions are nice in isolation but are most powerful in combination. The pipe, `%>%`, is particularly in important when combining many functions because it turns function composition on its head so you can read it from left-to-right. I'll show you how this has helped me build dplyr, rvest, ggvis, lowliner, stringr and more.

This talk will help you make best use of my recent packages, and teach you how to apply the same principles to make your own code easier to use.

Speaker Information:
Hadley is Chief Scientist at RStudio and Adjunct Professor of Statistics at Rice University. He is interested in building better tools for data science. His work includes R packages for data analysis (ggplot2, plyr, reshape2); packages that make R less frustrating (lubridate for dates, stringr for strings, httr for accessing web APIs); and that make it easier to do good software development in R (roxygen2, testthat, devtools, lineprof, staticdocs). He is also a writer, educator, and frequent contributor to conferences promoting more accessible and more effective data analysis.

Photo of Statistical Programming DC group
Statistical Programming DC
See more events
GWU Elliot School of Int'l Affairs
1957 E St NW - Room 213 · Washington, DC