Skip to content
Prev 320538 / 398506 Next

problem with plots with short example.

Hi Nicole

My code works using source file if I put

   library(runjags)
   x = testjags(findjags("windows",look_in = "c:/Program Files/JAGS"))
source("G:/Sweave/Bayes.R")

works ok

Further developments with Sweave. Putting this in the Sweave file

   library(runjags)
   x = testjags(findjags("windows",look_in = "c:/Program Files/JAGS"))

x
...
$JAGS.available
[1] TRUE

$JAGS.path
[1] "\"c:/Program Files/JAGS/JAGS-3.3.0/i386/bin/jags-terminal.exe\""
...

If I do not setwd() everything works fine for runjags but have not 
tried to plot any plots as pdf
Unfortunately it comes up in my  default
c:\Users\d mackay\Documents\

############################
Using setwd() before Sweave("G:/Sweave/Bayes.Rnw")
and in the Sweave file

# \Sweave file before run.jags call
   x = testjags(findjags("windows",look_in = "c:/Program Files/JAGS"))

It returns this error in the R command window

Error:  chunk 7 (label = JAGS2)
Error in run.jags(model = mod, monitor = "p", init = list(init1, init2),  :
   Unable to call JAGS

However x shows that it is finding JAGS
x
...
$JAGS.available
[1] TRUE

$JAGS.path
[1] "\"c:/Program Files/JAGS/JAGS-3.3.0/i386/bin/jags-terminal.exe\""

...

Latex tex file
You are currently logged on as d mackay, on a windows machine
You are using R version 2.15.3 (2013-03-01), with the Rgui GUI
JAGS version 3.3.0 found successfully using the command "c:/Program
Files/JAGS/JAGS-3.3.0/i386/bin/jags-terminal.exe"

So do not use setwd or change directory from the gui menu and it 
works but things end up where your default directory is

I am not sure what is going on but any assistance to fix it would be 
appreciated.

Regards

Duncan
At 12:45 29/03/2013, you wrote: