Skip to main content

Data Manipulation with data.table in R

Master core concepts about data manipulation such as filtering, selecting and calculating groupwise statistics using data.table.

Start Course for Free
4 Hours15 Videos59 Exercises19,659 Learners5050 XPData Analyst TrackData Manipulation Track

Create Your Free Account



By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA. You confirm you are at least 16 years old (13 if you are an authorized Classrooms user).

Loved by learners at thousands of companies

Course Description

The data.table package provides a high-performance version of base R's data.frame with syntax and feature enhancements for ease of use, convenience and programming speed. This course shows you how to create, subset, and manipulate data.tables. You'll also learn about the database-inspired features of data.tables, including built-in groupwise operations. The course concludes with fast methods of importing and exporting tabular text data such as CSV files. Upon completion of the course, you will be able to use data.table in R for a more efficient manipulation and analysis process. Throughout the course you'll explore the San Francisco Bay Area bike share trip dataset from 2014.

  1. 1

    Introduction to data.table


    This chapter introduces data.tables as a drop-in replacement for data.frames and shows how to use data.table's i argument to filter rows.

    Play Chapter Now
    Welcome to the course!
    50 xp
    data.table pop quiz
    50 xp
    Creating a data.table
    100 xp
    Introducing bikes data
    100 xp
    Filtering rows in a data.table
    50 xp
    Filtering rows using positive integers
    100 xp
    Filtering rows using negative integers
    100 xp
    Filtering rows using logical vectors
    100 xp
    Helpers for filtering
    50 xp
    I %like% data.tables
    100 xp
    Filtering with %in%
    100 xp
    Filtering with %between% and %chin%
    100 xp
  2. 2

    Selecting and Computing on Columns

    Just as the i argument lets you filter rows, the j argument of data.table lets you select columns and also perform computations. The syntax is far more convenient and flexible when compared to data.frames.

    Play Chapter Now
  3. 5

    Importing and Exporting Data

    Not only does the data.table package help you perform incredibly fast computations, it can also help you read and write data to disk with amazing speeds. This chapter focuses on data.table's fread() and fwrite() functions which let you import and export flat files quickly and easily!

    Play Chapter Now

In the following tracks

Data Analyst Data Manipulation


sumedhpanchadharSumedh PanchadharrichieRichie CottoneunkyungparkkEunkyung Parkbenjaminfeder-87fafd1d-ffc6-4bd6-9915-1dad3e0f844aBenjamin Feder


Intermediate R
Matt Dowle Headshot

Matt Dowle

Author of data.table

Matt Dowle is the main author of the data.table package. Matt has worked for some of the world’s largest financial organizations and has been programming in R for over a decade.
See More
Arun Srinivasan Headshot

Arun Srinivasan

R's data.table co-developer

Arun Srinivasan is originally from Tamilnadu, India. He holds a Bachelors degree in Electronics engineering and a Masters degree in Bioinformatics. He started using R in 2010 and has contributed to R's data.table package since late 2013. He currently lives in London, where he works as a developer and analyst in Finance. He has a passion for developing tools and algorithms facilitating analyses on large data.
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