如何重新安装base-R软件包(例如统计信息,图形,实用程序等)? [英] How do I reinstall a base-R package (e.g., stats, graphics, utils, etc.)?

查看:178
本文介绍了如何重新安装base-R软件包(例如统计信息,图形,实用程序等)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在R 3.0.1中使用"stats"包,没有任何问题.但是今天我从R库位置删除了"stats"文件夹,现在我不能再安装了.我尝试对其他软件包执行相同的操作,但是我可以安装除统计信息"以外的所有内容

I have been using the "stats" package in R 3.0.1 without any problems . But today i deleted the "stats" folder from the R library location and now I can't install it any more. I tried doing the same thing with other packages but I could install everything except "stats"

install.packages("stats", dep = TRUE, repos="http://cran.cs.wwu.edu")

## Installing package into ‘%Default R Lib Installation Path%’   
## (as ‘lib’ is unspecified)  
## Warning in install.packages :   package ‘stats’ is not available (for R version 3.0.1)

我还尝试从其他来源下载它,例如" http://cran.ma.imperial.ac .uk/",但没有任何效果.有什么想法吗?

I also tried downloading it from other sources like "http://cran.ma.imperial.ac.uk/" but nothing works . Any ideas?

推荐答案

(由于SO困扰我不要继续评论线程,因此我将发布答案.)

(Since SO is nagging me not to continue the comment thread, I will post an answer.)

我相信此问题将适用于任何基本软件包(但不适用于从存储库安装的那些软件包,并且可能不适用于推荐软件包):我非常怀疑stats only 软件包.对于此列表中的任何软件包,都应该发生这种情况:

I believe that this problem will apply to any base package (but not to those installed from repositories, and probably not to Recommended packages): I am deeply skeptical that stats is the only package. It should occur for any of the packages in this list:

rownames(subset(as.data.frame(installed.packages()),Priority=="base"))

我确信从理论上讲可以从头开始重新安装基本软件包,但是 重新安装R会容易得多.猜测,这大约需要15分钟重新安装R,如果我想出了如何在不到一个小时的时间内自行重新安装基本软件包的方法,我将感到非常幸运.

I'm sure it's theoretically possible to re-install a base package from scratch, but it will be much easier to re-install R. At a guess, it would take me about 15 minutes to re-install R, and I would feel lucky if I figured out how to re-install a base package on its own in less than an hour.

我非常确定重新安装R将不会影响先前安装的软件包:例如 http://cran .r-project.org/bin/windows/base/rw-FAQ.html#How-do-I-UNinstall-R_003f ;该链接是有关卸载而不是重新安装的,但这似乎是相关的:

I'm pretty sure that re-installing R will not affect previously-installed packages: see e.g. http://cran.r-project.org/bin/windows/base/rw-FAQ.html#How-do-I-UNinstall-R_003f; that link is about uninstalling rather than re-installing, but this seems relevant:

卸载R仅会从初始安装中删除文件,而不是从(例如)已安装或更新的软件包中删除文件.

Uninstalling R only removes files from the initial installation, not (for example) packages you have installed or updated.

其他选择是

  • 创建另一个相同的R安装(在另一台计算机上,或在非默认位置);在新安装中找到相关目录,然后将其复制到现有安装中.
  • 从备份中恢复相关目录.

PS :很明显,如果您是在客户的计算机上执行此操作,那么最好先测试我的建议...

PS: obviously if you are doing this on a client's machine it would be a good idea to test my advice first ...

这篇关于如何重新安装base-R软件包(例如统计信息,图形,实用程序等)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆