install.packages(“ devtools”)失败

时间:2018-08-31 17:48:59

标签: r devtools install.packages

我刚安装软件包和R, 看来我的devtools库不见了。

我试图安装漩涡, 我收到以下消息:

$(function(){

// Automatic update, strange function
setTimeout(function(){
  // Value updated automatically
  $('#long').val("90.000");
}, 2000);

/**
 * Detect if that field is updated by key press or pasting text
 */
$(document).on('keyup paste', 'input', function(){
  alert("Updated text field");
}); 

});

然后我尝试了以下方法:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" id="long">

所以我下载了zip格式的devtools并尝试加载

> install.packages("swirl")
Installing package into ‘C:/Users/cory/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Warning: failed to download mirrors file (cannot open destfile 'C:\Users\cory\AppData\Local\Temp\RtmpuA5tgZ\filef6c6874433a', reason 'No such file or directory'); using local file 'C:/PROGRA~1/R/R-35~1.1/doc/CRAN_mirrors.csv'
Warning: unable to access index for repository https://cran.cnr.berkeley.edu/src/contrib:
  cannot open destfile 'C:\Users\cory\AppData\Local\Temp\RtmpuA5tgZ\filef6c4b9547', reason 'No such file or directory'
Error in gzfile(file, mode) : cannot open the connection
In addition: Warning messages:
1: package ‘swirl’ is not available (for R version 3.5.1) 
2: In gzfile(file, mode) :
  cannot open compressed file 'C:\Users\cory\AppData\Local\Temp\RtmpuA5tgZ/libloc_194_4cc5b48b.rds', probable reason 'No such file or directory'

我在同一文件夹中下载了devtools zip,并将其重命名为devtoolz zip。 我尝试再次运行命令

> library(devtools)
Error in library(devtools) : there is no package called ‘devtools’

我应该采取什么步骤来安装devtools? 非常感谢! :)

2 个答案:

答案 0 :(得分:0)

我找到了解决方法, 万一它对别人有帮助:

*在Rstudio中,它调优了可以在不本地下载和指向URL的情况下安装软件包的方法(我也曾尝试过)。因为它与CRAN镜像集成在一起,所以我可以在框中简单地键入devtools并从现有的下拉菜单中选择它。

事实证明,它比尝试通过RGui手动导入更为有效。*

答案 1 :(得分:0)

我遇到了同样的问题,我只是关闭了RStudio并打开它,然后它起作用了。