Created
July 24, 2017 10:59
-
-
Save aloth/76a9de44c3fed013d2332e51571bfc3d to your computer and use it in GitHub Desktop.
Fetching tweets with R (sample for TC17)
This file contains 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
library(twitteR) | |
library(ROAuth) | |
## Twitter authentication | |
## Replace strings with your credentials | |
setup_twitter_oauth("consumer_key", "consumer_secret", | |
"access_token", "access_secret") | |
# Fetch tweets from user timeline | |
tweets <- userTimeline("xlth", n = 3200) | |
# Convert tweets to a data frame | |
tweets.df <- twListToDF(tweets) | |
# Wrtite CSV file with tweets | |
write.csv(tweets.df, file="tweets.csv") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment