SO:Linux Ubuntu 14.04 LTS R:R版本3.2.1(2015-06-18)-“世界著名的宇航员”版权所有(C)2015统计计算平台的R基础:i686-pc-linux-gnu(32位)
当我尝试安装软件包时rjags,出现以下致命错误:
install.packages("rjags")
Installing package into ‘/home/marco/.rkward/library’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
trying URL 'http://mirrors.softliste.de/cran/src/contrib/rjags_3-15.tar.gz'
Content type 'application/x-gzip' length 66879 bytes (65 KB)
==================================================
downloaded 65 KB
* installing *source* package ‘rjags’ ...
** package ‘rjags’ successfully unpacked and MD5 sums checked
checking for prefix by checking for jags... no
configure: error: "Location of JAGS headers not defined. Use configure arg '--with-jags-include' or environment variable 'JAGS_INCLUDE'"
ERROR: configuration failed for package ‘rjags’
* removing ‘/home/marco/.rkward/library/rjags’
The downloaded source packages are in
‘/tmp/RtmpditLat/downloaded_packages’
Warning message:
In install.packages("rjags") :
installation of package ‘rjags’ had non-zero exit status
Run Code Online (Sandbox Code Playgroud)
显然,第一个错误消息是
configure:错误:“未定义JAGS标头的位置。请使用configure arg'--with-jags-include'或环境变量'JAGS_INCLUDE'”
我该如何解决?
正如顶部评论所解释的,您需要在系统中安装 JAGS(另一个吉布斯采样器)。由于您使用的是 Ubuntu 14.04,因此运行
sudo apt-get install jags
Run Code Online (Sandbox Code Playgroud)
应该足够了。但是,如果您使用的是另一个发行版(或者由于某种原因,上面的代码不适合您),最好了解如何从源代码获取 JAGS:
安装成功后,您可以返回 R(无论如何,在整个过程中它可以保持打开状态)并安装您想要的软件包。