Installing packages in R is pretty easy, if you know the name of the package you wish to install. Just pass the name of the package to the install.packages() function. Once that’s done, load the package by passing its name to the library() function.
So it’s a fairly easy and straight-forward process, right?
But it wasn’t so when I attempted to install a Twitter client for R called TwitteR. R, by the way, is a very popular statistical programming language. It is Free Software.
Back to installing it.
My first attempt to do that, failed with the following message:
<strong>Warning in install.packages : package ‘twitterR’ is not available (for R version 3.1.1)</strong>
That’s strange. Why won’t TwitteR be available for R-3.1.1? Since that failed attempt was from the console of RStudio, an IDE for R, I decided to try installing it from RStudio’s Install packages tab. That was when I noticed why the first installation attempt failed: A simple spelling error. The package is spelled TwitteR, not TwitterR. See the difference? So to install TwitteR from RStudio’s console or from any other interactive R interface, type: <strong>install.packages("TwitteR")</strong>
. And don’t forget to load it: <strong>library("TwitteR")</strong>
.
Actually, the package is called ‘twitteR’ not ‘TwitteR’. Linux stuff is always case sensitive.