Running examples in ‘tmbstan-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: tmbstan
> ### Title: Draw MCMC samples from a TMB model object using Stan
> ### Aliases: tmbstan
> 
> ### ** Examples
> 
> runExample("simple")
Running example simple 

> require(TMB)

> dyn.load(dynlib("simple"))

> set.seed(123)

> y <- rep(1900:2010, each = 2)

> year <- factor(y)

> quarter <- factor(rep(1:4, length.out = length(year)))

> period <- factor((y > mean(y)) + 1)

> B <- model.matrix(~year + quarter - 1)

> A <- model.matrix(~period - 1)

> B <- as(B, "dgTMatrix")

> A <- as(A, "dgTMatrix")

> u <- rnorm(ncol(B))

> beta <- rnorm(ncol(A)) * 100

> eps <- rnorm(nrow(B), sd = 1)

> x <- as.numeric(A %*% beta + B %*% u + eps)

> obj <- MakeADFun(data = list(x = x, B = B, A = A), 
+     parameters = list(u = u * 0, beta = beta * 0, logsdu = 1, 
+         logsd0 = 1), random = .... [TRUNCATED] 

> opt <- nlminb(obj$par, obj$fn, obj$gr)
> fit <- tmbstan(obj, chains=1)

SAMPLING FOR MODEL 'tmb_generic' NOW (CHAIN 1).
Chain 1: 
Chain 1: Gradient evaluation took 5.3e-05 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.53 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1: 
Chain 1: 
Chain 1: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 1: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 1: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 1: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 1: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 1: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 1: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 1: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 1: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 1: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 1: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 1: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 1: 
Chain 1:  Elapsed Time: 1.20254 seconds (Warm-up)
Chain 1:                0.708805 seconds (Sampling)
Chain 1:                1.91135 seconds (Total)
Chain 1: 
> class(fit)  ## "stanfit"
[1] "stanfit"
attr(,"package")
[1] "rstan"
> 
> ## The available methods are
> methods(class="stanfit")
 [1] as.array           as.data.frame      as.matrix          constrain_pars    
 [5] dim                dimnames           extract            get_cppo_mode     
 [9] get_inits          get_logposterior   get_num_upars      get_posterior_mean
[13] get_seed           get_seeds          get_stancode       get_stanmodel     
[17] grad_log_prob      is.array           log_prob           loo               
[21] names              names<-            pairs              plot              
[25] print              show               summary            traceplot         
[29] unconstrain_pars  
see '?methods' for accessing help and source code
> 
> ## Not run: 
> ##D ## Pairs plot
> ##D pairs(fit, pars=names(obj$par))
> ## End(Not run)
> 
> ## Trace plot
> traceplot(fit, pars=names(obj$par), inc_warmup=TRUE)
Error in Summary.unit(c(4.4, 4.4), na.rm = FALSE) : 
  VECTOR_ELT() can only be applied to a 'list', not a 'double'
Calls: <Anonymous> ... render_strips -> build_strip -> ggstrip -> Summary.unit
Execution halted