Announcements
- Sign up to be CTLR tutors for MATH 116 and all things R! Contact Jeanne Albert at CTLR.
- HW-03 Discussion:
In-Class
- Slides: Introducing Application Programming Interfaces (API’s) and mining tweets with
twitteR
package
- In-class exercise:
- Packages to install:
twitteR
- Code:
Lec20.R
- Install
twitteR
package from RStudio (homepage is here)
- Create a Twitter account if you don’t already have one.
- Create a Twitter application at the Twitter Application Management
page by clicking “Create New App”. Give it whatever
name, description, and use https://rudeboybert.github.io/MATH216/ as the
webpage.
- Click the “Keys and Access Tokens” tab
- Note your “API key”, “API secret”
- Click on “Create my access token” button below and note your “Access Token”, and “Access Token Secret”.
- Replace the four values below with the values in your “Keys and Access Tokens”
page and run (no spaces or line breaks). Indicate yes to the prompt: “Use a local file to cache
OAuth access credentials between R sessions?”
library(twitteR)
setup_twitter_oauth(
"API key",
"API secret",
"Access token",
"Access token secret"
)
# Testing
some_tweets <- searchTwitter("election", n=100, lang="en")
After-Class Updates