

#Put the tweets downloaded into a ameĬlinton_tweets <- twListToDF(clinton_tweets) Trump_tweets <- userTimeline(user = 200, includeRts = FALSE, retryOnRateLimit = 2000) #Extract tweets from a single user at a timeĬlinton_tweets <- userTimeline(user = 200, includeRts = FALSE, retryOnRateLimit = 2000) This is a restriction of the Twitter Search API, and it often means you won’t actually get the number of tweets you specified. Unfortunately you can’t use the API to request tweets older than a week or two at most. We will use 200 in this example, but the maximum is 3200.

n = specifies how many tweets you want from the user. To get warmed up, let’s see what the two US presidential nominees have been talking about.ĭownloading tweets from a single user is very easy, just use the userTimeline() function from the twitteR package. To get a feel for the commands we will pass through the code, I urge you to have a look at Twitter’s API documentation.īefore we start, establish a connection to the twitter API (use the previously linked guide if this is your first time): #Type in your app details from Twitter here:
#Echofon for blackberry download code#
If you don’t have these packages, then use install.packages("NameOfPackage") before running the code above. There is probably a less messy way of getting around all this, but this gets the job done and allows you to get quicker to the interesting part: the analysis. I am going to use a combination of several (excellent) packages in order to achieve this. To make things a little interesting and current I will use tweets from the ongoing US election.
#Echofon for blackberry download how to#
I’ll leave the details of how to get OAuth and the dev-app running here, since it explains it better than I would have been able to.īy the end of this guide you will be able to download tweets from specific users and from lists, plotting commonly used words in their tweets and examine their tweeting behaviour by using meta-data. This guide requires that you have a Twitter account, R(studio), and have a twitter-dev account with OAuth. Lastly, I wanted to show how analysing the Twitter meta-data in addition to the tweets themselves can lead to better behavioural insights. To this end, I will provide some simple functions built on top of other packages that enable you to download tweets from pre-specified groups of people instead of just whoever tweets on a certain topic. This approach also means that the scripts we want to write have to be more reusable in nature in order to retrieve, load, and analyze several different groups repeatedly. Meta-data can be a rich source of information for that. As researchers however, we are often also interested in comparing and contrasting data between groups.

First, while there are many other guides on R-Bloggers that show similar things, they tend to focus more on setting up your Twitter account and using wordclouds. I wanted to write this guide for several reasons. For my first blog post on R, I want to show how to use R to mine Twitter-data.
