Last active
December 7, 2021 11:08
-
-
Save mGalarnyk/3715ed1588d403d9cfa19da65793f2cb to your computer and use it in GitHub Desktop.
Accessing Data from Twitter API using R (part1) for the blog post https://medium.com/@GalarnykMichael
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#install.packages("twitteR") | |
library(twitteR) | |
# Change the next four lines based on your own consumer_key, consume_secret, access_token, and access_secret. | |
consumer_key <- "OQMbUsBfWQ1mVUGASpSArbG33" | |
consumer_secret <- "GQ5kc0BlwJZE2FYyvv8cxn845z32ES6HsID87cawkQ075jwyIy" | |
access_token <- "4338966852-lBmLvEg9mADHIdjK2hT4W5mtHmI9jRKxcV4PTrB" | |
access_secret <- "AwKRZw9AvTMvMrb2jouX5JHTjDASI3zeceVsemgQa1SSq" | |
setup_twitter_oauth(consumer_key, consumer_secret, access_token, access_secret) | |
tw = twitteR::searchTwitter('#realDonaldTrump + #HillaryClinton', n = 1e4, since = '2016-11-08', retryOnRateLimit = 1e3) | |
d = twitteR::twListToDF(tw) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment