premium course

Writing Functions in R

Start Course For Free Play Trailer
  • 19 Videos
  • 86 Exercises
  • 4 hours 
  • 23,041 Participants
  • 7250 XP


Hadley Wickham
Hadley Wickham

Hadley is Chief Scientist at RStudio, an Adjunct Professor of Statistics at the University of Auckland, and author of many popular R packages including ggplot2, dplyr, and tidyr, among others. His passion is building tools (both computational and cognitive) that make data science easier, faster, and more fun. Hadley recently co-authored a book with Garrett Grolemund called R for Data Science.

Charlotte Wickham
Charlotte Wickham

Charlotte is an Assistant Professor in the Department of Statistics at Oregon State University and an avid R programmer with a passion for teaching. Her interests lie in spatiotemporal data, statistical graphics and computing, and environmental statistics.


Nick Carchedi Nick Carchedi

Tom Jeon Tom Jeon

Course Description

Functions are a fundamental building block of the R language. You've probably used dozens (or even hundreds) of functions written by others, but in order to take your R game to the next level, you'll need to learn to write your own functions. This course will teach you the fundamentals of writing functions in R so that, among other things, you can make your code more readable, avoid coding errors, and automate repetitive tasks.

1A quick refresher Free

Before we embark, we'll make sure you’re ready for this course by reviewing some of the prerequisites. You'll review the syntax of writing a function in R, the basic data types in R, subsetting and writing for loops. It won't all be review, we'll introduce you to a few new things that will be helpful throughout the course.