是否可以在R install.packages中定义包的版本?

时间:2022-02-14 14:14:29

I know that you can download old packages and install them with

我知道你可以下载旧包并安装它们

R CMD INSTALL package-version.tar.gz

I wonder if you can tell install.packages() to install a specific version from a repository, saving you from having to locate the tar.gz first. I have neither found this option in the help entry for install.packages nor googling for it. If this option does not exist, is there any reason for that?. I can only think that not all repos have all versions so you are forced to find the version first and download it.

我想知道你是否可以告诉install.packages()从存储库安装一个特定的版本,从而使你不必首先找到tar.gz。我既没有在install.packages的帮助条目中找到此选项,也没有使用Google搜索。如果此选项不存在,是否有任何理由?我只能认为并非所有的repos都有所有版本,所以你不得不首先找到该版本并下载它。

There is an equivalent question already in SO but the problem and answer is more about repository problems, so at the end they never answered this question directly.

SO中已经有一个等价的问题,但问题和答案更多的是关于存储库问题,所以最后他们从未直接回答过这个问题。

1 个解决方案

#1


11  

install.packages() does not, but there is a function install_version() in the devtools package which can install a version other than the most recent one from a CRAN repository.

install.packages()没有,但devtools包中有一个函数install_version(),它可以安装CRAN存储库中最新版本以外的版本。

#1


11  

install.packages() does not, but there is a function install_version() in the devtools package which can install a version other than the most recent one from a CRAN repository.

install.packages()没有,但devtools包中有一个函数install_version(),它可以安装CRAN存储库中最新版本以外的版本。