通过自制软件安装特定版本的R

我已经在macOS中通过Home-brew安装了R:

brew install R

但是,现在,我需要切换版本并安装特定的R版本。因此,我尝试通过两种方式安装R-3.5.2均未成功:

brew install R-3.5.2
brew install R@3.5.2

这就是我得到的:

Error: No available formula with the name "r@3.5.2" 
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.

你有什么主意吗? 谢谢:)

kuaihuoniao 回答:通过自制软件安装特定版本的R

免责声明:我没有可用于测试的Mac。

Here,您会找到一个非常有用的教程,了解如何通过自制软件安装旧版本,here是另一本教程。

对于R来说,它表示为:

git clone https://github.com/Homebrew/homebrew-core.git
cd homebrew-core/
git log master -- Formula/r.rb

对于R 3.5.2产生以下提交:

commit e66b3a288ee5e68c3c04e95705b7311c9f76bdf2
Author: ...
Date:   Sun Jan 13 10:59:16 2019 +0000

    r: update 3.5.2_2 bottle.

commit a2ced14fabb30732b2b6f22919105ac66085e78c
Author: ...
Date:   Tue Jan 8 10:36:41 2019 +0100

    r: revision for readline

commit 61c60b0c4c237a0ada3ab8b83b934566b101ee67
Author: ...
Date:   Sat Jan 5 04:06:37 2019 +0000

    r: update 3.5.2_1 bottle.

commit f9325e5e63ba812d1a2d5fd405811e313f782ff1
Author: ...
Date:   Fri Jan 4 17:36:34 2019 +0100

    r: build with openblas

commit 70aca0ac8f83459ff1ce18c1ea3f462b49434eb2
Author: ...
Date:   Fri Dec 21 06:48:02 2018 +0000

    r: update 3.5.2 bottle.

commit d344d5b57d0c8b0bf0ef6b3052e6bed551b37b47
Author: ...
Date:   Fri Dec 21 14:31:14 2018 +0800

    r 3.5.2

    Closes #35321.

您也可以通过URL搜索提交(请参阅this注释):

https://github.com/Homebrew/homebrew-core/search?q=r%203.5.2&type=commits


相应地,您应该能够通过(最新的R 3.5.2提交)安装R 3.5.2:

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/e66b3a288ee5e68c3c04e95705b7311c9f76bdf2/Formula/r.rb

或:

brew install https://github.com/Homebrew/homebrew-core/raw/e66b3a2/Formula/r.rb
article中提到的

brew switchbrew pin也可能很有趣。

本文链接:https://www.f2er.com/3117944.html

大家都在问