简体   繁体   English

轻松安装已从 CRAN 存储库中删除的软件包

[英]Install the package that has been removed from the CRAN repository easily

I want to use some packages, but they has been deleted in CRAN, though their formerly available versions can be obtained from the archive.我想使用一些软件包,但它们已在 CRAN 中删除,尽管它们以前可用的版本可以从存档中获得。 Those packages are not in r-forge, too.这些软件包也不在 r-forge 中。

For instance, dynamo and gafit .例如, dynamogafit

Though those packages have been removed, I find them still useful and can help me.尽管这些软件包已被删除,但我发现它们仍然有用并且可以帮助我。

Is it possible to and how to install them easily ?是否可以以及如何轻松安装它们? like one_line_install('http://sss.tar.gz') .one_line_install('http://sss.tar.gz')

By the way, I may use them in Windows and/or in OS X. So the code should be designed as "multi-platform".顺便说一下,我可能会在 Windows 和/或 OS X 中使用它们。所以代码应该被设计为“多平台”。

It is easy using the devtools package as there is no need to download the package yourself.使用devtools包很容易,因为不需要自己下载包。 For example:例如:

library(devtools)
install_url('http://cran.r-project.org/src/contrib/Archive/dynamo/dynamo_0.1.3.tar.gz')
install_url('http://cran.r-project.org/src/contrib/Archive/gafit/gafit_0.4.tar.gz')

I have no doubt this will be platform-independent.我毫不怀疑这将是独立于平台的。

The package has other related and useful functions such as install_version , install_local , install_github , etc.该软件包具有其他相关且有用的功能,例如install_versioninstall_localinstall_github等。

Depending on how far back you want to go, you can also use the MRAN snapshot archive.根据您想要回溯多远,您还可以使用MRAN 快照存档。 This is a sequence of daily snapshots of CRAN, going back to September 2014.这是 CRAN 的一系列每日快照,可追溯到 2014 年 9 月。

Eg to install a package from CRAN as it was on 30 June 2015:例如,从 2015 年 6 月 30 日的 CRAN 安装软件包:

install.package("my_package",
    repos="https://mran.microsoft.com/snapshot/2015-06-30")

Try尝试

install.packages('/path/dynamo_0.1.3.tar.gz', type = 'source')

where path is the path to the file you downloaded.其中path是您下载的文件的路径。 That is it on a Mac!在 Mac 上就是这样! On Windows you have to play a bit with the slashes :-)在 Windows 上,您必须使用斜杠 :-)

For what it's worth, package gafit is available again without resorting to tricks.对于它的价值,包 gafit 再次可用而无需诉诸技巧。

As suggested above it was broken for some years as the core R system changed some packaging conventions.正如上面所建议的那样,由于核心 R 系统改变了一些包装约定,它被打破了几年。 Hopefully fully fixed now.希望现在完全修复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM