# NOT RUN {
## The dataset example_tweets contains 10 public statuses published
## by @twitterapi in plain text format. The code below converts the object
## into a data frame that can be manipulated by other functions.
data(example_tweets)
tweets.df <- parseTweets(example_tweets, simplify=TRUE)
# }
# NOT RUN {
## A more complete example, that shows how to capture a user's home timeline
## for one hour using authentication via OAuth, and then parsing the tweets
## into a data frame.
library(ROAuth)
reqURL <- "https://api.twitter.com/oauth/request_token"
accessURL <- "http://api.twitter.com/oauth/access_token"
authURL <- "http://api.twitter.com/oauth/authorize"
consumerKey <- "xxxxxyyyyyzzzzzz"
consumerSecret <- "xxxxxxyyyyyzzzzzzz111111222222"
my_oauth <- OAuthFactory$new(consumerKey=consumerKey,
consumerSecret=consumerSecret,
requestURL=reqURL,
accessURL=accessURL,
authURL=authURL)
my_oauth$handshake()
userStream( file="my_timeline.json", with="followings",
timeout=3600, oauth=my_oauth )
tweets.df <- parseTweets("my_timeline.json")
# }
Run the code above in your browser using DataLab