San Francisco, California
London, United Kingdom
Should I take this course?
This class will be a good fit for you if you have some experience programming in R already. You should have written a number of functions, and be comfortable with R’s basic data structures (vectors, matrices, arrays, lists, and data frames). You will find the course particularly useful if you’re an experienced R user looking to take the next step, or if you’re moving to R from other programming languages and you want to quickly get up to speed with R’s unique features.
On the first day, you’ll get a solid grounding in R programming techniques. We’ll start by reinforcing the foundations of your R knowledge, and then go on to cover the three main paradigms of R programming: functional programming, object oriented programming and metaprogramming. On the second day, you’ll learn how to make R packages, the key to well-documented, well-tested and easily-distributed R code. With the right tools, making a package is easy. In fact, it’s so easy that it will become your default way of organizing code.
What should I bring?
The latest version of R.
A recent version of the RStudio IDE. (Even if you don’t use it, you’ll want to experience it for package development.)
We’ll let know know what packages you need to install a few days before the class.
At the course, you’ll download an (electronic) copy of all slides, code, and data.
Who will I learn from?
The class is taught by Hadley Wickham, Chief Scientist at RStudio and an Adjunct Professor of Statistics at Rice University. You may be familiar with his R packages for:
- Data analysis (ggplot2/ggvis, plyr/dplyr, reshape2/tidyr).
- Making R less frustrating (lubridate for dates, stringr for strings, httr for accessing web APIs)
- Package development (roxygen2, testthat, devtools).
Hadley will be assisted by teaching assistants (TAs) who will help you out with the hands-on exercises. These TAs are selected for both their communication skills and their mastery of R.
How is the course organised?
Day 1 - R programming
Foundations - The day starts with some warmups to get your brain in R-mode, and to make sure your foundations are solid.
- Key data structures
- Errors and debugging
Functional programming - At heart, R is a functional programming language, and functions can be used in many more ways than most R users assume. R has first class functions which means you can write functions that return functions, take functions as input, and save function in lists. This gives you a powerful set of tools for dealing with a broad class of problems.
- R’s rules for dynamic and lexical scoping
- Organize R programs around the “DRY” principle – “Don’t repeat yourself!”
- Understand functionals, like
- Use anonymous functions when a name isn’t needed.
- Build function factories: functions that write functions.
Object oriented programming - Though a functional language, R contains three systems of object oriented programming (OOP) features. These features revolve around the concepts of classes and methods and can dramatically simplify code. We’ll focus on S3, the oldest and most important form of OOP.
- S3 classes and constructors.
- How inheritance works in S3.
- Defining new S3 methods.
- Writing new generic functions.
Metaprogramming - Unlike most languages, R provides powerful tools for controlling when and where evaluation occurs. This lets you create functions tailored for interactive use that minimize typing with a little magic.
- Capture user input without evaluating it
- Control when and where R evaluates expressions and calls
- Mastering base functions such as
- Writing code that modifies code
Day 2 - R Packages
Through a series of demonstrations and hands on exercises, you will learn how to quickly build, document, test, and release R packages. The day is organised around the most common components of an R package.
R/: where your code lives.
DESCRIPTION: managing package metadata.
man/: documenting your functions with
vignettes/: documenting your package with R Markdown.
tests/: writing unit tests with testthat.
NAMESPACE: being a considerate player in the R ecosystem.
The day concludes with a discussion of releasing your package, including mastering
R CMD check, using github, continuous integration with traivs and submitting your package to CRAN.
We have a limited number of seats set aside for full-time students at a discounted rate. Please contact Elizabeth for details.
In certain cases, we may need to cancel this workshop due to circumstances beyond our control or otherwise. If this happens, RStudio will refund all registration fees for those who signed up. RStudio is not responsible for any related expenses incurred by registered attendees (including but not limited to travel and hotel expenses).
- More than 2 weeks before course: full refund, less 10% adminstrative fee.
- 1-2 weeks before course: 50% refund.
- Less than 1 week before course: no refund available
All public workshops hosted by RStudio come with a no-questions-asked money-back guarantee.
When & Where
RStudio is a company dedicated to providing software, education, and services for the R statistical computing environment. We started RStudio because we were excited and inspired by R. To learn more about us, visit our website at www.rstudio.com.