Unable to load rjags on windows 10

Viewed 751

I'm having trouble loading rjags. Operating system is Windows 10. R version is 4.1.1, and JAGS is 4.3.0. And rjags is installed through install.packages("rjags") Below is what happened when I tried to load rjags.

require(rjags)
Loading required package: rjags
Loading required package: coda
Error: package or namespace load failed for ‘rjags’:  .onLoad failed
in loadNamespace() for 'rjags', details:   call: fun(libname, pkgname)
error: Failed to locate any version of JAGS version 4

The rjags package is just an interface to the JAGS library
Make sure you have installed JAGS-4.x.y.exe (for any x >=0, y>=0) from
http://www.sourceforge.net/projects/mcmc-jags/files

The same error message also appeared when I tried JAGS 3.4.0, 4.1.0, and 4.2.0.

I saw on a different post that previously, people solved a similar issue by using an older version of JAGS. That solution didn't work, sadly. Could someone please help me with this?

1 Answers

I had the same issue. I found a solution on the JAGS website: I ran

Sys.setenv(JAGS_HOME="C:/Program Files/JAGS/JAGS-4.3.0")

at the RStudio console prompt and this seemed to fix the problem.

Related