简体   繁体   English

R tm 包不会加载到 R studio

[英]R tm package will not load to R studio

I have been trying to load the tm text mining package onto R studio for a number of hours now.我已经尝试将 tm 文本挖掘包加载到 R studio 几个小时了。 I have tried everything I have come across online but it doesnt appear to work.我已经尝试了我在网上遇到的一切,但它似乎不起作用。 I started with我开始了

install.packages('tm', dependencies = TRUE)

and am given the following error并给出以下错误

Installing package into ‘D:/Users/byrne/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
Warning in install.packages :
  dependencies ‘slam’, ‘Rcampdf’, ‘Rgraphviz’, ‘Rpoppler’, ‘tm.lexicon.GeneralInquirer’ are not available
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/tm_0.6-2.zip'
Content type 'application/zip' length 710948 bytes (694 KB)
downloaded 694 KB

when i then try to load the package using当我然后尝试使用加载包时

library(tm)

I get this error我收到这个错误

Loading required package: NLP
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
  there is no package called ‘slam’
Error: package or namespace load failed for ‘tm’

I have then loaded NLP and tried to load 'slam'.然后我加载了 NLP 并尝试加载“slam”。 which it then tells me is not available on R version 3.2.3.然后它告诉我在 R 版本 3.2.3 上不可用。 I then updated to 3.2.5 and it still gives me the same message.然后我更新到 3.2.5,它仍然给我同样的信息。 I have changed the CRAN mirror to mutliple different locations and still get the same error.我已将 CRAN 镜像更改为多个不同的位置,但仍然出现相同的错误。

Any help is greatly appreciated as I'm stumped now.非常感谢任何帮助,因为我现在很难过。

It is probably that 'slam' can not be installed because of '-lgfortran' package error.可能是因为 '-lgfortran' 包错误而无法安装 'slam'。 You need to apply below;您需要在下方申请;

  1. You need to close all R sessions also R Studio.您需要关闭所有 R 会话以及 R Studio。
  2. Open terminal and type xcode-select --install打开终端并输入 xcode-select --install
  3. Type curl -O http://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2键入curl -O http://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2
  4. Type sudo tar fvxz gfortran-4.8.2-darwin13.tar.bz2 -C /键入sudo tar fvxz gfortran-4.8.2-darwin13.tar.bz2 -C /
  5. You can install 'slam' now.你现在可以安装'slam'。

Try sudo apt-get install r-cran-slam on your terminal在您的终端上尝试sudo apt-get install r-cran-slam

It should work properly after that.之后它应该可以正常工作。

use command使用命令

install.packages("tm", repos="http://R-Forge.R-project.org") install.packages("tm", repos="http://R-Forge.R-project.org")

Dependency package ' slam ' is not available until R version 3.3.1 and you are using version 3.2.X.依赖包“ slam ”在 R 3.3.1 版之前不可用,并且您使用的是 3.2.X 版。

Also, keep in mind that some of the dependency packages (like Rgraphviz) are no longer at the CRAN repository, but are at the Bioconductor site as explained in the answer to this question.另外,请记住,一些依赖包(如 Rgraphviz)不再位于 CRAN 存储库中,而是位于Bioconductor站点,如问题的答案中所述。

每当它说“没有名为 --- 的包”时,只需安装该包,重新启动您的 r 会话,这一次它会正常加载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM