简体   繁体   English

在Rstudio中安装软件包时出错

[英]Error installing packages in Rstudio

I have R 3.2.2 setup installed in my system,with RStudio version 0.99.489. 我的系统中安装了R 3.2.2安装程序,RStudio版本为0.99.489。 When I tried to install rJava package, 当我尝试安装rJava软件包时,

install.packages("rJava")

I am getting following Error: 我收到以下错误消息:

Warning in install.packages : install.packages中的警告:
downloaded length 4878 != reported length 200 下载的长度4878!=报告的长度200
Error in install.packages : subscript out of bounds install.packages中的错误:下标超出范围

But if I run the below command before installing any package,it works fine, but I don't want to do this every time I install a package. 但是,如果我在安装任何软件包之前运行以下命令,它就可以正常工作,但是我不想每次安装软件包时都这样做。

options(repos=structure(c(CRAN="http://cran.us.r-project.org")))

You can stick the line you want executed at every startup in your .Rprofile file which should be in your home directory. 您可以将要在每次启动时执行的行粘贴到应位于主目录中的.Rprofile文件中。 I have 3.2.3 version of R and that worked; 我有3.2.3版本的R,并且可以正常工作; however I do get a warning message about using a non-http version of the site. 但是我确实收到有关使用非HTTP版本站点的警告消息。

Similarly to you, I was finding the original repository the system was using was failing to install the packages--not finding the package or downloading a file with too few bytes, perhaps because of a transient problem. 与您类似,我发现系统正在使用的原始存储库未能安装软件包-找不到软件包或下载字节太少的文件,可能是由于暂时性问题。 You might want to consider not putting this in your .Rprofile file or commenting the line outin case this is a temporary workaround. 您可能要考虑不要将其放在.Rprofile文件中,也不要注释掉该行,以防这是一个临时解决方法。

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

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