安装BayesLogit软件包

时间:2018-11-20 16:27:16

标签: r package cran

我正在尝试在R中安装BayesLogit软件包。该软件包已从CRAN网站上删除,但是我具有源文件BayesLogit_0.6.tar.gz。我尝试跑步

install.packages("BayesLogit_0.6.tar.gz", type = "source", repos = NULL)

但出现以下错误:软件包“ BayesLogit_0.6.tar.gz”的安装退出状态为非零。

任何人都可以提供帮助,或者您不能再安装此软件包?我已经将该软件包安装在另一台计算机上,当它在CRAN网站上时又将其重新安装。

2 个答案:

答案 0 :(得分:0)

我能够使用devtools::install_version("BayesLogit", "0.6")

在Ubuntu计算机上安装软件包

由于该软件包包含C ++源文件,因此您非常需要编译工具。如果使用Windows,则意味着您将需要安装RTools。在Mac上,您将需要Xcode command line tools。另请参见How do I install a package that has been archived from CRAN?https://cran.r-project.org/bin/windows/Rtools/

答案 1 :(得分:0)

Linux

在R会话中运行以下命令:

10ee

macOS

从源代码编译BayesLogit需要GFortran,后者需要XCode和命令行工具:

  • 从App Store安装XCode,或仅安装命令行工具(例如,从this thread开始)
  • 安装install.packages("devtools") # optional, in case you don't have it require(devtools) install_version("BayesLogit", version = "0.6") # the latest version on CRAN archive ,例如使用an appropriate disk image
  • 在R中运行与上面相同的代码:
gfortran

替代软件包

GitHub page of BayesLogit的最新更新时间是11个月前,因此我猜测它不会在CRAN上。另一个选择是this package,它实现与install.packages("devtools") # optional, in case you don't have it require(devtools) install_version("BayesLogit", version = "0.6") # the latest version on CRAN archive 相同的Polya-Gamma方案,并且语法非常相似:

BayesLogit

要安装# BayesLogit obj <- BayesLogit::logit(y=y, X=X, P0=diag(rep(precision, ncol(X)), samp=n_samples, burn=burn) # PolyaGamma obj <- PolyaGamma::gibbs_sampler(y=y, X=X, lambda=precision, n_iter_total=burn + n_samples, burn_in=burn) 软件包,请在R会话中运行以下命令:

PolyaGamma
相关问题