filmov
tv
R Tutorial: Introduction: Working With Web Data in R
![preview_player](https://i.ytimg.com/vi/7Plc7XVcpfc/maxresdefault.jpg)
Показать описание
---
Hi, I'm Oliver Keyes, and I'm Charlotte Wickham. Welcome to Working with Web Data in R.
It turns out that the Internet is a great place to find datasets, and this course teaches you how to get those datasets into R in order to analyze them.
You'll start with the simplest cases: simply downloading files to your machine, and using existing packages specifically designed for pulling in web data.
Next you'll use the tidyverse package httr to query web application programming interfaces using the GET() and POST() commands.
After that, you'll learn how to work with JSON and XML, the two most common data formats used by websites. Typically, datasets in R are rectangular, so they can be stored in a data frame or matrix. JSON and XML are both nested data structures, so you'll learn new techniques to explore them, including XPath, the XML query language.
Finally, you'll learn to use Cascading Style Sheets, or CSS, to navigate HTML pages and extract their data.
First, let's begin with the easy case. Many functions in base R that are used for importing data accept a URL, so you can directly import the data from its location on the Internet. For example, to retrieve a CSV file that you found on the Internet, you can still call read dot csv().
The only change to your code is that rather than passing a path to a local file is that you pass a URL.
Since downloading data from the Internet every time that you want to use it can be very slow and tedious, especially for large datasets, R provides the function download dot file() to copy Internet-based files to your machine. This takes two arguments: the URL where the file lives, and a path to somewhere on your local file system that you want to download the data to.
Now let's try some examples.
#DataCamp #RTutorial #Web #Data