Skip to main content
HomeR

Course

Web Scraping in R

IntermediateSkill Level
4.7+
81 reviews
Updated 04/2024
Learn how to efficiently collect and download data from any website using R.
Start Course for Free
RData Preparation4 hr13 videos45 Exercises3,600 XP14,857Statement 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

Have you ever come across a website that displays a lot of data such as statistics, product reviews, or prices in a format that’s not data analysis-ready? Often, authorities and other data providers publish their data in neatly formatted tables. However, not all of these sites include a download button, but don’t despair. In this course, you’ll learn how to efficiently collect and download data from any website using R. You'll learn how to automate the scraping and parsing of Wikipedia using the rvest and httr packages. Through hands-on exercises, you’ll also expand your understanding of HTML and CSS, the building blocks of web pages, as you make your data harvesting workflows less error-prone and more efficient.

Prerequisites

Intermediate RIntroduction to the Tidyverse
1

Introduction to HTML and Web Scraping

In this chapter, you'll be introduced to Hyper Text Markup Language (HTML), a declarative language used to structure modern websites. Using the rvest library, you'll learn how to query simple HTML elements and scrape your first table.
Start Chapter
2

Navigation and Selection with CSS

3

Advanced Selection with XPATH

4

Scraping Best Practices

Now that you know how to extract content from web pages, it's time to look behind the curtains. In this final chapter, you’ll learn why HTTP requests are the foundation of every scraping action and how they can be customized to comply with best practices in web scraping.
Start Chapter
Web Scraping 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 81 reviews
75%
21%
4%
0%
0%
  • Faruk
    15 hours ago

  • Marin
    5 days ago

    Very interesting and a rapid way to learn important material while being hands-on and practicing your knowledge immediately after you read or hear the lesson.

  • Vassilios
    last week

  • Salih
    2 weeks ago

  • FABIAN
    2 weeks ago

    Great

  • Árpád
    2 weeks ago

Faruk

Vassilios

Árpád

FAQs

Which R packages are used for web scraping in this course?

You will use the rvest package for parsing HTML and extracting data, along with the httr package for making HTTP requests and handling web page responses.

Do I need to know HTML and CSS before starting this course?

No. The course teaches you the HTML and CSS fundamentals needed for web scraping, including how elements are structured and how to use CSS selectors to target data.

What website is used for hands-on scraping practice?

You will practice automating the scraping and parsing of Wikipedia pages, learning to extract tables and other structured content from real web pages.

Will I learn to handle common scraping errors and edge cases?

Yes. The course teaches you techniques to make your data harvesting workflows less error-prone and more efficient when dealing with real-world web content.

What can I do with web scraping skills in a data science workflow?

You can collect data from websites that lack download options, such as price listings, statistics tables, and product reviews, and prepare it for analysis in R.

Join over 19 million learners and start Web Scraping 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.