Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fetching tweets with R (sample for TC17)
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