Search code examples
rjagsr2jags

Attach() -> object not found error (R2Jags)


I am using the R2Jags package.

I first obtain the model as follows:

jags.data = list("Y"=y, "N"=N, Y1=y[1], C=x1)
# The parameters that we are monitoring (must monitor at least 1)
jags.params=c("sd.q","sd.r","Y", "X1", "X2")
model.loc=("ss_model.txt")
mod_ss = jags(jags.data, parameters.to.save=jags.params, model.file=model.loc, n.chains = 3, 
              n.burnin=5000, n.thin=1, n.iter=10000, DIC=TRUE)  

But then when I use the following to get the posterior valeus of X1:

attach(mod_ss)
X1

I get:

Error: object 'X1' not found

My question: how come and what can I do to fix this?

Thanks in advance.


Solution

  • Problem solved:

    It seems that in the new version of R2Jags the correct function to call is:

    attach.jags(mod_ss, overwrite=TRUE)
    

    [So attach.jags instead of attach()]