Defensive R Programming

Learn defensive programming in R to make your code more robust.
Start Course for Free
4 Hours16 Videos51 Exercises2,543 Learners
3400 XP

Create Your Free Account

GoogleLinkedInFacebook
or
By continuing you accept the Terms of Use and Privacy Policy. You also accept that you are aware that your data will be stored outside of the EU and that you are above the age of 16.

Loved by learners at thousands of companies


Course Description

Writing R scripts is easy. Writing good R code is hard. In this course, we'll discuss defensive programming - a set of standard techniques that will help reduce bugs and aid working in teams. We examine techniques for avoiding common errors and also how to handle the inevitable error that arises in our code. The course will conclude looking at when to make the transition from script to project to package.

  1. 1

    Avoiding Conflict

    Free
    In this first chapter, you'll learn what defensive programming is, and how to use existing packages for increased efficiency. You will then learn to manage the packages loaded in your environment and the potential conflicts that may arise.
    Play Chapter Now
  2. 2

    Early warning systems

    Programming is simpler when you get feedback on your code execution. In R, we use messages, warnings and errors to signal to keep the user informed. This chapter will discuss when and where you should use these communication tools.
    Play Chapter Now
  3. 3

    Preparing your defenses

    We can avoid making mistakes using a consistent programming approach. In this chapter, we will introduce you to R best practices.
    Play Chapter Now
  4. 4

    Creating a Battle Plan

    Creating a script is nice, but working on a project with several scripts and assets requires structure. This final chapter will teach you good organization practices, so you can go from script to package with an optimal workflow.
    Play Chapter Now
In the following tracks
R Programmer
Collaborators
Richie CottonHadrien Lacroix
Prerequisites
Intermediate R
Colin Gillespie Headshot

Colin Gillespie

Assoc Prof at Newcastle University, Consultant at Jumping Rivers
Colin is the author of Efficient R Programming, published by O'Reilly media. He is an Associate Professor of Statistics at Newcastle University, UK and regularly works with Jumping Rivers to provide data science training and consultancy. He is the only person in history to move to Newcastle for better weather.
See More

What do other learners have to say?

I've used other sites—Coursera, Udacity, things like that—but DataCamp's been the one that I've stuck with.

Devon Edwards Joseph
Lloyds Banking Group

DataCamp is the top resource I recommend for learning data science.

Louis Maiden
Harvard Business School

DataCamp is by far my favorite website to learn from.

Ronald Bowers
Decision Science Analytics, USAA