Skip to main content
HomeRDefensive R Programming

Defensive R Programming

Learn defensive programming in R to make your code more robust.

Start Course for Free
4 Hours16 Videos51 Exercises
4,401 LearnersTrophyStatement of Accomplishment

Create Your Free Account

GoogleLinkedInFacebook

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.
GroupTraining 2 or more people?Try DataCamp For Business

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.
For Business

GroupTraining 2 or more people?

Get your team access to the full DataCamp library, with centralized reporting, assignments, projects and more
Try DataCamp for BusinessFor a bespoke solution book a demo.
  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
    Defensive R Programming
    50 xp
    Real Programmers...
    50 xp
    Don't reinvent the wheel/package
    50 xp
    Updating Packages
    50 xp
    Out of Date Packages
    100 xp
    Task Views
    50 xp
    Packages and Namespaces
    50 xp
    Number of Loaded Packages
    50 xp
    Counting Exported Functions
    100 xp
    The Conflicted Package
    100 xp
  2. 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 Developer

Collaborators

Collaborator's avatar
Hadrien Lacroix
Collaborator's avatar
Richie Cotton

Prerequisites

Intermediate R
Colin Gillespie HeadshotColin 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?

Join over 13 million learners and start Defensive R Programming today!

Create Your Free Account

GoogleLinkedInFacebook

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.