Free course

Importing Data Into R

Learn how to parse data in any format. Whether it's flat files, statistics software, databases, or web data, you'll handle it all.

Start Free Course
4 Hours11 Videos68 Exercises28,488 Learners
5850 XP

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

Importing data into R to start your analyses: it should be the easiest step. Unfortunately, this is almost never the case. Data can come in all sorts of formats, ranging from flat files and statistical software files to databases and web data. Knowing which approach to use is key to getting started with the actual analysis. In this course, you will learn all the basics on how to load data into R so you can get up and running in no time!

  1. 1

    Importing data from flat files


    Lots of data comes in the form of flat files: simple tabular text files. Learn how to import all common formats of flat file data with base R functions and the dedicated readr and data.table packages.

    Play Chapter Now
    Introduction & Flat Files
    50 xp
    100 xp
    100 xp
    100 xp
    100 xp
    Any changes?
    50 xp
    100 xp
    Column classes
    100 xp
    readr & data.table
    50 xp
    100 xp
    100 xp
    col_types, skip and n_max
    100 xp
    col_types with collectors
    100 xp
    100 xp
    fread: more advanced use
    100 xp
    Dedicated classes
    50 xp
  2. 2

    Importing data from Excel


    Excel is a very widely used data analysis tool. If you prefer to do your analyses in R, though, you'll need an understanding of importing CSV data into R. This chapter will explain you how to use readxl and gdata to do so. The XLConnect package that takes all of this one step further, will also be discussed.

    Play Chapter Now
  3. 4

    Importing data from relational databases


    Many companies store their information in relational databases. The R community has also developed R packages to get data from these architectures. You'll learn how to connect to a database, how to retrieve data from it, and how to make things more efficient by performing a part of your computations on the database side.

    Play Chapter Now
  4. 5

    Importing data from the web


    More and more of the information that data scientists are using, resides on the web. Importing this data into R requires an understanding of protocols and typical data formats used on the web. In this chapter, you'll get a crash course in HTTP, learn to perform your own HTTP requests from inside R and get to know a popular web data format: JSON.

    Play Chapter Now


Emna ChahedFrauke Hein
Filip Schouwenaars Headshot

Filip Schouwenaars

Data Science Instructor at DataCamp

Filip is the passionate developer behind several of DataCamp's interactive courses, covering both R and Python. Under the motto 'Eat your own dog food', he has used the techniques DataCamp teaches its students to perform data analysis for DataCamp. Filip holds degrees in Electrical Engineering and Artificial Intelligence.
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