O'Reilly logo

R Data Analysis Cookbook - Second Edition by Kuntal Ganguly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Getting ready

First, sign up for a Twitter developer account (https://apps.twitter.com) and create a sample application to generate API keys and credentials under the Keys and Access Token tab, which we will require later to fetch real-time data from Twitter.

Then install the following packages:

install.packages(c("twitteR","RColorBrewer","plyr","ggplot2","devtools","httr"))require(devtools)

The packages sentiment, Rstem, and slam are not available for direct installation in R (version 3.2 or higher), so you need to install it from source using the following command in the R console:

install_url("https://cran.r-project.org/src/contrib/Archive/Rstem/Rstem_0.4-1.tar.gz")install_url("https://cran.r-project.org/src/contrib/Archive/slam/slam_0.1-37.tar.gz") ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required