Introduction to Importing Data in R

Start Free Preview

Buying via our links supports this free directory · Affiliate disclosure.
Course facts
  • Payment: Free Preview (Paid Upgrade)
  • Learning style: Self-paced, start anytime
  • Format: Text & Interactive
  • Video access: Streaming Only
  • Before you start: Introduction to R
DataCamp details
  • Chapters: 4
Created byDataCamp
Available onDataCamp

Course Details
Learning Style

Start Anytime

Level

Beginner

Study Mode

100% Online

Duration

Short (< 10 Hours)

Languages
Audio Language

English

Outcomes
Certificate

Certificate of Completion

Price & Terms
Pricing Model

Free Preview (Paid Upgrade)

Technical
Content Medium

Text & Interactive

Video Access

Streaming Only

Specification
Access

Subscription

SKU: introduction-importing-data-r Category: Tags: , Brand:

Learn to import CSV, tab-delimited text and Excel files into R with base functions, readr, data.table, readxl and XLConnect.

At a glance
Duration3 hrs
LevelBeginner
CertificateCertificate of Completion
LanguageEnglish
AccessSubscription
Add your review
Add to wishlistAdded to wishlistRemoved from wishlist 0
Add to compare

Getting a dataset into R is often harder than it should be, since data arrives in many formats and each one calls for its own approach. You learn to read comma-separated and tab-delimited text files, set column names and column types as the data loads, and pull individual sheets out of Excel workbooks. The final part goes further with Excel, editing workbooks inside R so the spreadsheet can stay part of a repeatable workflow.

What You Will Achieve

  • Load CSV and tab-delimited text files with base R and assign the right column names and classes
  • Choose between readr and data.table for a large flat file and limit which rows and column types get read
  • List the sheets in an Excel file and import only the ones an analysis needs
  • Add, populate, rename and remove worksheets in an Excel workbook directly from R


Program Overview

Flat Files with Base R Functions

The utils functions that ship with R for reading simple tabular text files, including how to point R at a file path.

  • read.csv and reading from a path
  • read.delim and read.table
  • Assigning column names and column classes

Efficient Flat File Imports with readr and data.table

Two dedicated packages that read flat files more consistently, with finer control over the rows and column types that get loaded.

  • read_csv, read_tsv and read_delim
  • skip, n_max and col_types with collectors
  • fread and its more advanced use
  • Dedicated classes for imported data

Excel Data with readxl and Reproducible Work with XLConnect

Reading sheets with readxl, then connecting to workbooks through XLConnect to read, adapt and manage sheets inside R.

  • Listing and importing sheets with readxl
  • The col_names and skip arguments
  • Connecting to a workbook and customizing readWorksheet
  • Adding, populating, renaming and removing sheets

Certificate Awarded (Paid)


Job Outlook

Loading external data cleanly is the first step of most analysis work in R, so these skills apply wherever analysts and data scientists receive CSV exports, delimited text files or Excel workbooks before starting an analysis.


Our take

Good for: R users who regularly receive CSV exports, delimited text files or Excel workbooks and want a dependable way to load each one before analysis.

Keep in mind: The four chapters center on flat text files and Excel workbooks; statistical software files, databases and HTML data are not imported in any lesson.

Bottom line: A practical side-by-side look at base R, readr, data.table, readxl and XLConnect on flat files and Excel workbooks.

Frequently Asked Questions

Why are several packages taught for the same file types?

Each one suits a different situation. Base R functions need no extra packages, readr and data.table read flat files faster and more consistently, and readxl and XLConnect give increasing control over Excel workbooks, so you can pick the tool that fits each file.

How does XLConnect differ from readxl?

readxl is used here to list and read sheets from an Excel file. XLConnect connects to a whole workbook, reads and customizes worksheets, and also adds, populates, renames and removes sheets, which keeps Excel inside a reproducible R workflow.

Which import settings can I control while reading a file?

In base R you assign column names and column classes. With readr you set skip, n_max and col_types, including collectors, while readxl offers the col_names and skip arguments for Excel sheets. The fread function from data.table also gets a look at its more advanced options.

What counts as a flat file in R?

A flat file is a simple tabular text file, such as a comma-separated or tab-delimited one. The first half of the course reads these with the utils functions in base R and then with the readr and data.table packages.

User Reviews

0.0 out of 5
★★★★★
0
★★★★★
0
★★★★★
0
★★★★★
0
★★★★★
0

No reviews yet. Be the first to review this course.

There are no reviews yet.

Write your review

Reviews can only be posted by registered learners. Log in, then you will return here to post.

×

    Report this page
    Introduction to Importing Data in R
    Introduction to Importing Data in R
    LiveTalent
    Logo
    Compare items
    • Total (0)
    Compare
    0