Skip to main content
HomeR

Course

Introduction to Importing Data in R

BasicSkill Level
4.7+
342 reviews
Updated 03/2026
In this course, you will learn to read CSV, XLS, and text files in R using tools like readxl and data.table.
Start Course for Free
RData Preparation3 hr10 videos37 Exercises3,150 XP200K+Statement of Accomplishment

Create Your Free Account

or

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

Loved by learners at thousands of companies

Group

Training 2 or more people?

Try DataCamp for Business

Course Description

Importing data into R should be the easiest step in your analysis. Unfortunately, that is almost never the case. Data can come in many formats, ranging from .csv and text files, to statistical software files, to databases and HTML data. Knowing which approach to use is key to getting started with the actual analysis. In this course, you’ll start by learning how to read .csv and text files in R. You will then cover the readr and data.table packages to easily and efficiently import flat file data. After that, you will learn how to read .xls files in R using readxl.

Prerequisites

Introduction to R
1

Importing data from flat files with utils

A lot of data comes in the form of flat files: simple tabular text files. Learn how to import the common formats of flat file data with base R functions.
Start Chapter
2

readr & data.table

3

Importing Excel data

Excel is a widely used data analysis tool. If you prefer to do your analyses in R, though, you'll need an understanding of how to import .csv data into R. This chapter will show you how to use readxl to do so.
Start Chapter
4

Reproducible Excel work with XLConnect

Beyond importing data from Excel, you can take things one step further with XLConnect. Learn all about it and bridge the gap between R and Excel.
Start Chapter
Introduction to Importing Data in R
Course
Complete

Earn Statement of Accomplishment

Add this credential to your LinkedIn profile, resume, or CV
Share it on social media and in your performance review
Enroll Now

Don’t just take our word for it

*4.7
from 342 reviews
82%
17%
1%
0%
0%
  • Aitor
    yesterday

  • Luis Massimo
    last week

    Recommended for a beginner with no experience in importing data

  • Stefan
    last week

    Sehr gut!

  • Zach
    last week

  • Jeff
    2 weeks ago

  • James
    2 weeks ago

Aitor

"Sehr gut!"

Stefan

Jeff

FAQs

What prior knowledge do I need for this course?

You should be comfortable with the basics of R, such as working with variables, vectors, and functions. Introduction to R is the only listed prerequisite.

Who is this course designed for?

R users who regularly receive data from external sources and want a reliable, efficient approach to loading it before analysis. It is relevant for analysts and data scientists working with flat files, Excel workbooks, or mixed data sources.

What file formats will I be able to import after completing this course?

You will be able to import CSV and tab-delimited text files using base R and the readr package, Excel workbooks using readxl, and perform more advanced Excel operations such as adding, renaming, and removing sheets using XLConnect.

Why does this course cover multiple packages for importing the same file types?

Each package has different strengths. Base R functions work without additional dependencies, readr and data.table are faster and more consistent for large flat files, and readxl and XLConnect offer progressively more control over Excel workbooks. The course helps you choose the right tool for each situation.

What is the difference between readxl and XLConnect?

readxl is focused on reading Excel files quickly and cleanly. XLConnect goes further, letting you write data back to workbooks, add and remove sheets, and manipulate Excel files directly from R — making it useful when Excel is part of a shared or reproducible workflow.

How is this course structured?

The course has four chapters. Chapter 1 covers importing flat files with base R functions. Chapter 2 introduces readr and data.table for more efficient flat file imports. Chapter 3 covers reading Excel files with readxl. Chapter 4 uses XLConnect to read, write, and manage Excel workbooks from R.

Join over 19 million learners and start Introduction to Importing Data in R today!

Create Your Free Account

or

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

Grow your data skills with DataCamp for Mobile

Make progress on the go with our mobile courses and daily 5-minute coding challenges.