无法在R中加载'tm'包

时间:2017-09-12 14:48:27

标签: r tm

这是我第一次尝试在R中安装和加载tm包,到目前为止我没有成功。这是我的机器信息:

> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] RevoUtilsMath_10.0.0

loaded via a namespace (and not attached):
[1] compiler_3.4.0   RevoUtils_10.0.4 tools_3.4.0

我通过运行以下代码进行安装:

install.packages('tm', repos = 'https://cran.r-project.org', dependencies = T)  

给我以下消息:

Warning in install.packages :
dependencies ‘Rcampdf’, ‘Rgraphviz’, ‘Rpoppler’, ‘tm.lexicon.GeneralInquirer’ are not available
also installing the dependencies ‘NLP’, ‘Rcpp’, ‘slam’, ‘BH’, ‘filehash’, ‘SnowballC’, ‘XML’
...
...
package ‘NLP’ successfully unpacked and MD5 sums checked
package ‘Rcpp’ successfully unpacked and MD5 sums checked
package ‘slam’ successfully unpacked and MD5 sums checked
package ‘BH’ successfully unpacked and MD5 sums checked
package ‘filehash’ successfully unpacked and MD5 sums checked
package ‘SnowballC’ successfully unpacked and MD5 sums checked
package ‘XML’ successfully unpacked and MD5 sums checked
package ‘tm’ successfully unpacked and MD5 sums checked

但是当我尝试加载包时,它会给我以下错误:

load('tm')
Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection
In addition: Warning message:
In readChar(con, 5L, useBytes = TRUE) :
  cannot open compressed file 'tm', probable reason 'No such file or directory'

欣赏任何智慧的帮助/话语

1 个答案:

答案 0 :(得分:1)

load()函数重新加载以前保存的数据集。

你正在寻找library()函数,正如@Marco Sandri在评论中指出的那样。

尝试:

library(tm)