title: jags.parallel - Error in get(name, envir = envir) : invalid first argument
body: <p>When using <code>jags.parallel</code>, I get the following error:</p>
  
  <pre><code>&gt; out &lt;- jags.parallel(win.data, inits, params, "Poisson.OD.t.test.txt",
  + nc, ni, nb, nt);
  Error in get(name, envir = envir) : invalid first argument
  </code></pre>
  
  <p>The same call using <code>jags</code> function runs OK. I have only found <a href="http://sourceforge.net/p/mcmc-jags/discussion/610037/thread/8f9dd526/" rel="nofollow">one thread on this topic</a>, but there is only one speculative suggestion that does not apply nor work here.</p>
  
  <p>Reproducible code, taken from <a href="http://www.mbr-pwrc.usgs.gov/software/kerybook/R_WB_code.txt" rel="nofollow">Introduction to WinBUGS for ecologists, see chapter 14.1</a> (slightly modified):</p>
  
  <pre><code>set.seed(123)
  
  ### 14.1.2. Data generation
  n.site &lt;- 10
  x &lt;- gl(n = 2, k = n.site, labels = c("grassland", "arable"))
  eps &lt;- rnorm(2*n.site, mean = 0, sd = 0.5)# Normal random effect
  lambda.OD &lt;- exp(0.69 +(0.92*(as.numeric(x)-1) + eps) )
  lambda.Poisson &lt;- exp(0.69 +(0.92*(as.numeric(x)-1)) ) # For comparison
  
  C.OD &lt;- rpois(n = 2*n.site, lambda = lambda.OD)
  C.Poisson &lt;- rpois(n = 2*n.site, lambda = lambda.Poisson)
  
  ### 14.1.4. Analysis using WinBUGS
  # Define model
  sink("Poisson.OD.t.test.txt")
  cat("
  model {
  # Priors
   alpha ~ dnorm(0,0.001)
   beta ~ dnorm(0,0.001)
   sigma ~ dunif(0, 10)   
   tau &lt;- 1 / (sigma * sigma)
   maybe_overdisp &lt;- mean(exp_eps[])
  
  # Likelihood
   for (i in 1:n) {
      C.OD[i] ~ dpois(lambda[i]) 
      log(lambda[i]) &lt;- alpha + beta *x[i] #+ eps[i]
      eps[i] ~ dnorm(0, tau)
      exp_eps[i] &lt;- exp(eps[i])
   }
  }
  ",fill=TRUE)
  sink()
  
  
  # Bundle data
  win.data &lt;- list(C.OD = C.OD, x = as.numeric(x)-1, n = length(x))
  
  # Inits function
  inits &lt;- function(){ list(alpha=rlnorm(1), beta=rlnorm(1), sigma = rlnorm(1))}
  
  # Parameters to estimate
  params &lt;- c("lambda","alpha", "beta", "sigma", "maybe_overdisp")
  
  # MCMC settings
  nc &lt;- 3     # Number of chains
  ni &lt;- 3000     # Number of draws from posterior per chain
  nb &lt;- 1000     # Number of draws to discard as burn-in
  nt &lt;- 5     # Thinning rate
  
  require(R2jags)
  
  # THIS WORKS FINE
  out &lt;- R2jags::jags(win.data, inits, params, "Poisson.OD.t.test.txt",
      nc, ni, nb, nt);
  
  # THIS PRODUCES ERROR
  out &lt;- jags.parallel(win.data, inits, params, "Poisson.OD.t.test.txt",
      nc, ni, nb, nt);
  
  # THIS ALSO PRODUCES ERROR
  out &lt;- do.call(jags.parallel, list(win.data, inits, params, "Poisson.OD.t.test.txt",
      nc, ni, nb, nt));
  </code></pre>