我正在尝试运行snaMIC.R脚本,该脚本正在对Twitter数据进行情绪分析。但它失败了,说错误是在R 3.0.0之前构建了包情绪:请重新安装。我使用的是R-3.1.0 i386(32位获胜)。我注意到的另一件事是我没有在“安装包”下获得情绪包。我从中下载了sentiment_0.2.zip文件 http://cms.unipune.ernet.in/~webmaster/cran/bin/windows/contrib/2.14/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’
答案 0 :(得分:1)
首先,我注意到URL实际上提供下载RStem.zip,而不是sentiment_0.2.zip。
我认为您的错误消息更有用的说法是:您已经下载了R 2.14的二进制包,去找R 3.0(或更高版本)的二进制包,然后下载并安装它。 / p>
以下是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上,这可能是非平凡的......
答案 1 :(得分:1)
我已经解决了上述问题“失败错误:'包''情绪'是在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")