Book Image

Mastering Data analysis with R

By : Gergely Daróczi
Book Image

Mastering Data analysis with R

By: Gergely Daróczi

Overview of this book

Table of Contents (19 chapters)
Mastering Data Analysis with R
Credits
www.PacktPub.com
Preface

R-related posts in social media


One option to collect posts from the past few days of social media is processing Twitter's global stream of Tweet data. This stream data and API provides access to around 1 percent of all tweets. If you are interested in all this data, then a commercial Twitter Firehouse account is needed. In the following examples, we will use the free Twitter search API, which provides access to no more than 3,200 tweets based on any search query—but this will be more than enough to do some quick analysis on the trending topics among R users.

So let's load the twitteR package and initialize the connection to the API by providing our application tokens and secrets, generated at https://apps.twitter.com:

> library(twitteR)
> setup_twitter_oauth(...)

Now we can start using the searchTwitter function to search tweets for any keywords, including hashtags and mentions. This query can be fine-tuned with a couple of arguments. Since, until, and n set the beginning and end date...