R Tutorial: Understanding Application Programming Interfaces
Key Takeaways
This video tutorial covers the basics of Application Programming Interfaces (APIs) and how to interact with them using R, specifically using the pageviews package to retrieve Wikipedia page views.
Full Transcript
so far you've used techniques for downloading static files and keeping them around but most data on the internet doesn't take that form it's simply not practical if you've got complex data or simply a lot of it you'd have to waste time and space constantly copying data into csv files in the background every time something changes for websites like Wikipedia and Facebook there are hundreds and millions of changes every day so it doesn't really make sense as an approach instead people often make data available behind application programming interfaces or ap is these are programs designed to let code interact with the website in the same way you interact with a web page and they used pretty much everywhere one of the places they used is in making data available instead of a website having to constantly write data to CSVs it can just hook an API out to its database instead of the user having to type in a new URL each time they can make small consistent modifications that change the instructions the API is given for what to send back what those URLs and instructions look like is something we'll discuss later in the course because one of the great things about API is on the web is they make it trivial to write API clients software libraries in various languages including our that make it possible for programmers or data scientists to interact with the API without ever having to care about how it's structured or do the heavy lifting of cleaning up the data nine times out of ten if you're looking to get data out of an API our probably has a client for it that is an R package that contains functions to retrieve that data one simple useful trick is to Google cran and then the name of the website to see if one exists and if there is a client you should rely on it as much as possible because much of the time it's a lot easier than writing your own now you're going to see an example of this using the pageviews package which lets you see the number of views of Wikipedia pages all you have to do is call the function article underscore pageviews passing the name of a Wikipedia article you're calling an R function just like any other and don't need to worry about the details of the API now it's your turn to try an example
Original Description
Want to learn more? Take the full course at https://learn.datacamp.com/courses/working-with-web-data-in-r at your own pace. More than a video, you'll learn hands-on coding & quickly apply skills to your daily work.
---
So far you've used techniques for downloading static files and keeping them around, but most data on the Internet doesn't take that form. It's simply not practical: if you've got complex data, or simply a lot of it, you'd have to waste time and space constantly copying data into CSV files in the background every time something changes. For websites like Wikipedia and Facebook, there are hundreds of millions of changes every day, so it doesn't really make sense as an approach.
Instead, people often make data available behind Application Programming Interfaces, or APIs. These are programs designed to let code interact with a website, in the same way you interact with a web page, and they're used pretty much everywhere. One of the places they're used is in making data available. Instead of a website having to constantly write data to CSVs, it can just hook an API up to its database. Instead of the user having to type in a new URL each time, they can make small, consistent modifications that change the instructions the API is given for what to send back.
What those URLs and instructions look like is something we'll discuss later in the course, because one of the great things about APIs on the web is they make it trivial to write API clients: software libraries in various languages that make it possible for programmers or data scientists to interact with the API without ever having to care about how it's structured, or do the heavy lifting of cleaning up the data.
Nine times out of ten, if you're looking to get data out of an API, R probably has a client for it, that is, an R package that contains functions to retrieve that data.
One simple, useful trick is to Google "CRAN" and then the name of the website to see if one exists. And if there is a clien
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from DataCamp · DataCamp · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
SQL Server Tutorial: Date manipulation
DataCamp
R Tutorial: Intermediate Interactive Data Visualization with plotly in R
DataCamp
R Tutorial: Adding aesthetics to represent a variable
DataCamp
R Tutorial: Moving Beyond Simple Interactivity
DataCamp
Python Tutorial: Why use ML for marketing? Strategies and use cases
DataCamp
Python Tutorial: Preparation for modeling
DataCamp
Python Tutorial: Machine Learning modeling steps
DataCamp
R Tutorial: The prior model
DataCamp
R Tutorial: Data & the likelihood
DataCamp
R Tutorial: The posterior model
DataCamp
R Tutorial: An Introduction to plotly
DataCamp
R Tutorial: Plotting a single variable
DataCamp
R Tutorial: Bivariate graphics
DataCamp
Python Tutorial: Customer Segmentation in Python
DataCamp
Python Tutorial: Time cohorts
DataCamp
Python Tutorial: Calculate cohort metrics
DataCamp
Python Tutorial: Cohort analysis visualization
DataCamp
R Tutorial: Building Dashboards with flexdashboard
DataCamp
R Tutorial: Anatomy of a flexdashboard
DataCamp
R Tutorial: Layout basics
DataCamp
R Tutorial: Advanced layouts
DataCamp
Python Tutorial: Time Series Analysis in Python
DataCamp
Python Tutorial: Correlation of Two Time Series
DataCamp
Python Tutorial: Simple Linear Regressions
DataCamp
Python Tutorial: Autocorrelation
DataCamp
R Tutorial: The gapminder dataset
DataCamp
R Tutorial: The filter verb
DataCamp
R Tutorial: The arrange verb
DataCamp
R Tutorial: The mutate verb
DataCamp
R Tutorial: What is cluster analysis?
DataCamp
R Tutorial: Distance between two observations
DataCamp
R Tutorial: The importance of scale
DataCamp
R Tutorial: Measuring distance for categorical data
DataCamp
Python Tutorial: Plotting multiple graphs
DataCamp
Python Tutorial: Customizing axes
DataCamp
Python Tutorial: Legends, annotations, & styles
DataCamp
Python Tutorial: Introduction to iterators
DataCamp
Python Tutorial: Playing with iterators
DataCamp
Python Tutorial: Using iterators to load large files into memory
DataCamp
SQL Tutorial: Introduction to Relational Databases in SQL
DataCamp
SQL Tutorial: Tables: At the core of every database
DataCamp
SQL Tutorial: Update your database as the structure changes
DataCamp
Python Tutorial: Classification-Tree Learning
DataCamp
Python Tutorial: Decision-Tree for Classification
DataCamp
Python Tutorial: Decision-Tree for Regression
DataCamp
Python Tutorial: Census Subject Tables
DataCamp
Python Tutorial: Census Geography
DataCamp
Python Tutorial: Using the Census API
DataCamp
R Tutorial: A/B Testing in R
DataCamp
R Tutorial: Baseline Conversion Rates
DataCamp
R Tutorial: Designing an Experiment - Power Analysis
DataCamp
R Tutorial: Introduction to qualitative data
DataCamp
R Tutorial: Understanding your qualitative variables
DataCamp
R Tutorial: Making Better Plots
DataCamp
SQL Tutorial: OLTP and OLAP
DataCamp
SQL Tutorial: Storing data
DataCamp
SQL Tutorial: Database design
DataCamp
Python Tutorial: Introduction to spaCy
DataCamp
Python Tutorial: Statistical Models
DataCamp
Python Tutorial: Rule-based Matching
DataCamp
More on: API Design
View skill →Related AI Lessons
⚡
⚡
⚡
⚡
Common Next.js Errors (and How I Solved Them)
Dev.to · gary killen
Applying Scalability in Backend (CodeBuddy)
Medium · LLM
Why Every Backend Developer Should Learn Nginx Before Going to Production
Medium · DevOps
Connecting Frontend to Backend: A Backend Engineer’s Reality Check
Medium · Programming
🎓
Tutor Explanation
DeepCamp AI