gpt4 book ai didi

r - 如何在 Ubuntu 上安装 Rjags

转载 作者:太空宇宙 更新时间:2023-11-03 16:49:14 27 4
gpt4 key购买 nike

我正在尝试在 Ubuntu 上安装 Rjags,我首先安装了这个

sudo apt-get install JAGS

那我试过了

R
install.packages("rjags")

我有以下错误

    > install.packages("rjags") 
Installing package into ‘/home/louis/R/x86_64-pc-linux-gnu-library/3.4’

(as ‘lib’ is unspecified)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 71719 100 71719 0 0 46062 0 0:00:01 0:00:01 --:--:-- 46032
* installing *source* package ‘rjags’ ...
** package ‘rjags’ successfully unpacked and MD5 sums checked
checking for pkg-config... /usr/bin/pkg-config
configure: Setting compile and link flags according to pkg-config
configure: Compile flags are -I/usr/include/JAGS
configure: Link flags are -ljags
checking for gcc... x86_64-conda_cos6-linux-gnu-cc
checking whether we are using the GNU C compiler... no
checking whether x86_64-conda_cos6-linux-gnu-cc accepts -g... no
checking for x86_64-conda_cos6-linux-gnu-cc option to accept ISO C89... unsupported
checking for jags_version in -ljags... no
configure: error: "cannot link to JAGS library in /usr/lib."
ERROR: configuration failed for package ‘rjags’
* removing ‘/home/charlie/R/x86_64-pc-linux-gnu-library/3.4/rjags’

The downloaded source packages are in
‘/tmp/Rtmp9yfeon/downloaded_packages’
Warning message:
In install.packages("rjags") :
installation of package ‘rjags’ had non-zero exit status

我不知道如何解决这个问题,谢谢你的帮助

Andrey Kolyadin,我已经按照您的指示进行操作,安装后我得到了这个

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
r-cran-rjags
1 upgraded, 0 newly installed, 0 to remove and 296 not upgraded.
Need to get 88,6 kB of archives.
After this operation, 1 024 B of additional disk space will be used.
Get:1 http://ppa.launchpad.net/marutter/rrutter/ubuntu xenial/main amd64 r-cran-rjags amd64 1:4.6-1cran4ubuntu1ppa1~ubuntu16.04.1~ppa1 [88,6 kB]
Fetched 88,6 kB in 1s (68,8 kB/s)
(Reading database ... 250343 files and directories currently installed.)
Preparing to unpack .../r-cran-rjags_1%3a4.6-1cran4ubuntu1ppa1~ubuntu16.04.1~ppa1_amd64.deb ...
Unpacking r-cran-rjags (1:4.6-1cran4ubuntu1ppa1~ubuntu16.04.1~ppa1) over (1:4-5-1) ...
Setting up r-cran-rjags (1:4.6-1cran4ubuntu1ppa1~ubuntu16.04.1~ppa1) ...

然后我尝试调用 R 中的库,但没有检测到它,不幸的是......

最佳答案

If you installed it from the ppa suggested by andrey, remove it with

sudo apt-add-repository --remove ppa:marutter/rrutter

(然后)更新您的数据:

sudo apt update

然后从默认安装

sudo apt install r-cran-rjags

在 R 中测试它。

R

在 R 中:

>library(rjags)
# Loading required package: coda
# Linked to JAGS 4.2.0
# Loaded modules: basemod,bugs

(可能是多余的,只是为了 SEO^^:) 也适用于 Linux Mint

关于r - 如何在 Ubuntu 上安装 Rjags,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49023107/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com