1

我正在尝试运行 snaMIC.R 脚本,该脚本正在对 Twitter 数据进行情绪分析。但它失败并出现错误说包情绪是在 R 3.0.0 之前构建的:请重新安装。我正在使用 R-3.1.0 i386(32 位获胜)。我注意到的另一件事是我没有在“安装包”下获得情绪包。我从http://cms.unipune.ernet.in/~webmaster/cran/bin/windows/contrib/2.14/sentiment_0.2.zip下载了sentiment_0.2.zip 文件 并在默认的R win-library 下成功解压. 但是“安装包”下仍然没有情感包。我添加了一些更多的存储库,但这并没有帮助。任何建议将不胜感激。

> 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’
4

2 回答 2

1

首先,我注意到 URL 实际上提供下载 RStem.zip,而不是 Sentiment_0.2.zip。

我认为你的错误信息会更有帮助:你已经下载了 R 2.14 的二进制包,去找到 R 3.0(或更高版本)的二进制包,然后下载并安装它。

这里是 3.1 包: http: //www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.1/

所以也许你可以尝试下载和安装: http: //www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.1/Rstem_0.4-1.zip

如果这不起作用,您可以尝试查找源包并以这种方式安装。但在 Windows 上,这可能不是微不足道的......

于 2014-05-24T13:40:03.120 回答
1

我已经解决了上述“错误失败:'package'sentiment'是在 R 3.0.0 之前构建的问题的解决方案:请重新安装它”。从 R 控制台使用以下命令序列:

require(devtools)
install_url("http://cran.r-project.org/src/contrib/Archive/sentiment/sentiment_0.2.tar.gz")
require(sentiment)
ls("package:sentiment")
于 2014-05-26T13:20:55.540 回答