删除不附带R全包(Remove all packages that do not come with

2019-09-02 00:36发布

我怎样才能删除除所有已安装的软件包baserecommended

Answer 1:

代替

已更新至R 3.0.0和必须重建所有软件包。

做就是了

update.packages(..., checkBuilt=TRUE)

这是我做我的[R 3.0.0(使用lib.loc=...指向我不同的本地目录)。 这将更新你的一切,它仍然可以从回购如CRAN 获得 。 对于install_git()等,你的运气了,需要重新安装。

但无论哪种方式,你并不需要先删除软件包。



Answer 2:

小心! 并尝试在此之前阅读文档:

# Pasted as a commented to prevent blindly copying and pasting
# remove.packages( installed.packages( priority = "NA" )[,1] )

默认情况下,这将删除从第一个库包在你的.libPaths()



Answer 3:

如果在Linux上,最简单的办法可能是删除库文件夹,在默认情况下位于/home/yourusername/R

在Fedora,例如,它被称为x86_64-redhat-linux-gnu-library 。 如果该文件夹/home/yourusername/R/x86_64-redhat-linux-gnu-library被删除,它会自动在河的下面开始重新创建所有默认库都经常使用。



Answer 4:

下面是在R-Blogger功能可用的解决方案:

# create a list of all installed packages
 ip <- as.data.frame(installed.packages())
 head(ip)
# if you use MRO, make sure that no packages in this library will be removed
 ip <- subset(ip, !grepl("MRO", ip$LibPath))
# we don't want to remove base or recommended packages either\
 ip <- ip[!(ip[,"Priority"] %in% c("base", "recommended")),]
# determine the library where the packages are installed
 path.lib <- unique(ip$LibPath)
# create a vector with all the names of the packages you want to remove
 pkgs.to.remove <- ip[,1]
 head(pkgs.to.remove)
# remove the packages
 sapply(pkgs.to.remove, remove.packages, lib = path.lib)

这里是链接,原帖: https://www.r-bloggers.com/how-to-remove-all-user-installed-packages-in-r/



文章来源: Remove all packages that do not come with R
标签: r package