Failed with error: ‘package ‘sentiment’ was built before R 3.0.0: please re-install it’

4.8k views Asked by At

I am trying to run the snaMIC.R script which is doing sentiment analysis on twitter data. But it is failing with an error saying package sentiment was built before R 3.0.0: please re-install. I am using R-3.1.0 i386 (32 bits win). Another thing that I noted is that I am not getting the sentiment package under "Install packages". I downloaded sentiment_0.2.zip file from http://cms.unipune.ernet.in/~webmaster/cran/bin/windows/contrib/2.14/sentiment_0.2.zip and unpacked it successfully under the default R win-library. But the sentiment package is still not available under "Install packages". I added some more repositories but that did not help. Any suggestions will be highly appreciated.

> source('snaMIC.R')
Loading required package: ROAuth
Loading required package: RCurl
Loading required package: bitops
Loading required package: digest
Loading required package: rjson
Loading required package: twitteR
Loading required package: stringr
Loading required package: ggplot2
Loading required package: grid
Loading required package: tm
Loading required package: NLP

Attaching package: ‘NLP’

The following object is masked from ‘package:ggplot2’:

    annotate

Loading required package: rJava

Attaching package: ‘rJava’

The following object is masked from ‘package:RCurl’:

    clone

Loading required package: Snowball
Installing package into ‘C:/Users/schakrabarti/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
Loading required package: Snowball
Loading required package: wordcloud
Loading required package: Rcpp
Loading required package: RColorBrewer
Loading required package: topicmodels
Loading required package: slam
Loading required package: plyr

Attaching package: ‘plyr’

The following object is masked from ‘package:twitteR’:

    id

Loading required package: png
Loading required package: Snowball
Loading required package: sentiment
Failed with error:  ‘package ‘sentiment’ was built before R 3.0.0: please re-install it’
In addition: Warning messages:
1: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘Snowball’
2: package ‘Snowball’ is not available (for R version 3.1.0) 
3: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘Snowball’
4: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘Snowball’
Loading required package: Snowball
Loading required package: sentiment
Failed with error:  ‘package ‘sentiment’ was built before R 3.0.0: please re-install it’
In addition: Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘Snowball’
Loading required package: Snowball
Loading required package: sentiment
Failed with error:  ‘package ‘sentiment’ was built before R 3.0.0: please re-install it’
In addition: Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘Snowball’
2

There are 2 answers

0
somnathchakrabarti On BEST ANSWER

I have come over the solution for above problem of "Failed with error: ‘package ‘sentiment’ was built before R 3.0.0: please re-install it". Used the following sequence of commands from R console:

require(devtools)
install_url("http://cran.r-project.org/src/contrib/Archive/sentiment/sentiment_0.2.tar.gz")
require(sentiment)
ls("package:sentiment")
1
Darren Cook On

First, I notice that URL actually offers to download RStem.zip, not sentiment_0.2.zip.

I think what your error message would be more helpful saying is: you've downloaded a binary package for R 2.14, go and find the binary package for R 3.0 (or later) and download and install that instead.

Here are the 3.1 packages: http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.1/

So perhaps you can try downloading and installing: http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.1/Rstem_0.4-1.zip

If that doesn't work, you could try finding the source package and installing it that way. But on Windows that might be non-trivial...