删除所有不附带R的包

时间:2020-12-26 17:42:48

How can I remove all installed packages except base and recommended?

除了base和推荐之外,如何删除所有已安装的包?

3 个解决方案

#1


12  

Instead of

而不是

Updated to R 3.0.0 and have to rebuild all packages.

更新到R 3.0.0,并必须重新构建所有包。

just do

只做

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

which is what I did on my R 3.0.0 (using lib.loc=... to point to my different local directories). This will update everything you have and which it can still get from repos such as CRAN. For install_git() etc, you are out of luck and need to reinstall.

这就是我在R 3。0上做的(使用lib.loc=…)指向不同的本地目录)。这将更新您所拥有的以及仍然可以从CRAN等repos获得的所有内容。对于install_git()等,您运气不佳,需要重新安装。

But either way you do not need to remove the packages first.

但是无论哪种方式,都不需要首先删除包。

#2


17  

Be CAREFUL! And read the docs before you try this:

小心!在你尝试这个之前先阅读一下文档:

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

By default this will remove packages from the first library in your .libPaths().

默认情况下,这将从. libpaths()中的第一个库中删除包。

#3


1  

If on Linux, the easiest thing is probably to remove the library folder, which by default is located in /home/yourusername/R.

如果在Linux上,最简单的事情可能是删除library文件夹,默认位于/home/yourusername/R中。

On Fedora, for example, it is called x86_64-redhat-linux-gnu-library. If the folder /home/yourusername/R/x86_64-redhat-linux-gnu-library is deleted, it is automatically recreated at the following start of R. All default libraries are regularly available.

例如,在Fedora上,它被称为x86_64 redhat-linux-gnu-library。如果删除文件夹/home/yourusername/R/x86_64-redhat-linux-gnu-library,则会在以下R开头自动重新创建所有默认库。

#1


12  

Instead of

而不是

Updated to R 3.0.0 and have to rebuild all packages.

更新到R 3.0.0,并必须重新构建所有包。

just do

只做

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

which is what I did on my R 3.0.0 (using lib.loc=... to point to my different local directories). This will update everything you have and which it can still get from repos such as CRAN. For install_git() etc, you are out of luck and need to reinstall.

这就是我在R 3。0上做的(使用lib.loc=…)指向不同的本地目录)。这将更新您所拥有的以及仍然可以从CRAN等repos获得的所有内容。对于install_git()等,您运气不佳,需要重新安装。

But either way you do not need to remove the packages first.

但是无论哪种方式,都不需要首先删除包。

#2


17  

Be CAREFUL! And read the docs before you try this:

小心!在你尝试这个之前先阅读一下文档:

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

By default this will remove packages from the first library in your .libPaths().

默认情况下,这将从. libpaths()中的第一个库中删除包。

#3


1  

If on Linux, the easiest thing is probably to remove the library folder, which by default is located in /home/yourusername/R.

如果在Linux上,最简单的事情可能是删除library文件夹,默认位于/home/yourusername/R中。

On Fedora, for example, it is called x86_64-redhat-linux-gnu-library. If the folder /home/yourusername/R/x86_64-redhat-linux-gnu-library is deleted, it is automatically recreated at the following start of R. All default libraries are regularly available.

例如,在Fedora上,它被称为x86_64 redhat-linux-gnu-library。如果删除文件夹/home/yourusername/R/x86_64-redhat-linux-gnu-library,则会在以下R开头自动重新创建所有默认库。