提问人:Hack-R 提问时间:10/3/2014 最后编辑:Hack-R 更新时间:10/4/2014 访问量:967
R - tm.plugin.sentiment 中缺少函数
R - missing function in tm.plugin.sentiment
问:
R 有一个用于文本挖掘包的情感分析插件,称为 。我正在尝试使用此包,但在运行该函数时收到缺少函数错误。tm
tm.plugin.sentiment
score
# Libraries ---------------------------------------------------------------
install.packages("tm")
install.packages("tm.plugin.sentiment", repos="http://R-Forge.R-project.org")
require(tm)
require(tm.plugin.sentiment)
# Data --------------------------------------------------------------------
data(crude)
corpus <- Corpus(VectorSource(crude))
corpus <- tm_map(corpus, stripWhitespace)
corpus <- tm_map(corpus, removePunctuation)
corpus <- tm_map(corpus, stemDocument)
# Score -------------------------------------------------------------------
score <- score(corpus)
运行时,此代码将导致:
score <- score(corpus)
Error in polarity.TermDocumentMatrix(list(i = c(43L, 79L, 102L, 138L,
could not find function "tm_tag_score"
这听起来像是我认为必须弃用(?),但我在安装时没有收到依赖项错误。tm.plugin.tags
此外,此页面似乎表明缺少的功能应该属于活动包,但是我尝试过的每台机器和版本都会发生此错误。tm
tm
> sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: i386-w64-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets
[6] methods base
other attached packages:
[1] tm.plugin.sentiment_0.0.1 quantmod_0.4-0
[3] TTR_0.22-0 xts_0.9-7
[5] zoo_1.7-11 Defaults_1.1-1
[7] tm_0.6 NLP_0.1-3
loaded via a namespace (and not attached):
[1] grid_3.1.0 lattice_0.20-29 parallel_3.1.0
[4] slam_0.1-32 SnowballC_0.5.1 tools_3.1.0
答: 暂无答案
评论
sessionInfo()
tm