安装BayesLogit包

问题描述 投票:1回答:2

我正在尝试在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网站上安装了它。

r package cran
2个回答
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/


0
投票

Linux

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

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

macOS

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

  • 从App Store安装XCode,或仅安装命令行工具(例如,从this thread
  • 安装gfortran,例如使用an appropriate disk image
  • 在R中运行与上面相同的代码:
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

Alternative package

GitHub page of BayesLogit最近更新于11个月前,所以我冒昧地猜测它不会出现在CRAN上。另一种选择是this package,它实现了与BayesLogit相同的Polya-Gamma方案,并且具有非常相似的语法:

# 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)

要安装PolyaGamma软件包,请在R会话中运行以下命令:

install.packages("devtools")  # optional, in case you don't have it
require(devtools)
devtools::install_github("kasparmartens/PolyaGamma")
library(PolyaGamma)
© www.soinside.com 2019 - 2024. All rights reserved.