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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: find_inverted_chains
> ### Title: Find which chains to invert
> ### Aliases: find_inverted_chains
> 
> ### ** Examples
> 
> set.seed(2)
> s <- sim_dfa(num_trends = 2)
> set.seed(1)
> m <- fit_dfa(y = s$y_sim, num_trends = 1, iter = 500, chains = 2)

SAMPLING FOR MODEL 'dfa' NOW (CHAIN 1).
Chain 1: 
Chain 1: Gradient evaluation took 6.1e-05 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.61 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1: 
Chain 1: 
Chain 1: Iteration:   1 / 500 [  0%]  (Warmup)
Chain 1: Iteration:  50 / 500 [ 10%]  (Warmup)
Chain 1: Iteration: 100 / 500 [ 20%]  (Warmup)
Chain 1: Iteration: 150 / 500 [ 30%]  (Warmup)
Chain 1: Iteration: 200 / 500 [ 40%]  (Warmup)
Chain 1: Iteration: 250 / 500 [ 50%]  (Warmup)
Chain 1: Iteration: 251 / 500 [ 50%]  (Sampling)
Chain 1: Iteration: 300 / 500 [ 60%]  (Sampling)
Chain 1: Iteration: 350 / 500 [ 70%]  (Sampling)
Chain 1: Iteration: 400 / 500 [ 80%]  (Sampling)
Chain 1: Iteration: 450 / 500 [ 90%]  (Sampling)
Chain 1: Iteration: 500 / 500 [100%]  (Sampling)
Chain 1: 
Chain 1:  Elapsed Time: 0.928025 seconds (Warm-up)
Chain 1:                1.05483 seconds (Sampling)
Chain 1:                1.98285 seconds (Total)
Chain 1: 

SAMPLING FOR MODEL 'dfa' NOW (CHAIN 2).
Chain 2: 
Chain 2: Gradient evaluation took 3.7e-05 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.37 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2: 
Chain 2: 
Chain 2: Iteration:   1 / 500 [  0%]  (Warmup)
Chain 2: Iteration:  50 / 500 [ 10%]  (Warmup)
Chain 2: Iteration: 100 / 500 [ 20%]  (Warmup)
Chain 2: Iteration: 150 / 500 [ 30%]  (Warmup)
Chain 2: Iteration: 200 / 500 [ 40%]  (Warmup)
Chain 2: Iteration: 250 / 500 [ 50%]  (Warmup)
Chain 2: Iteration: 251 / 500 [ 50%]  (Sampling)
Chain 2: Iteration: 300 / 500 [ 60%]  (Sampling)
Chain 2: Iteration: 350 / 500 [ 70%]  (Sampling)
Chain 2: Iteration: 400 / 500 [ 80%]  (Sampling)
Chain 2: Iteration: 450 / 500 [ 90%]  (Sampling)
Chain 2: Iteration: 500 / 500 [100%]  (Sampling)
Chain 2: 
Chain 2:  Elapsed Time: 0.930692 seconds (Warm-up)
Chain 2:                0.630945 seconds (Sampling)
Chain 2:                1.56164 seconds (Total)
Chain 2: 
Inverting chains 0 for trend 1
> # chains were already inverted, but we can redo that, as an example, with:
> find_inverted_chains(m$model, plot = TRUE)
Error in grid.Call.graphics(C_setviewport, vp, TRUE) : 
  VECTOR_ELT() can only be applied to a 'list', not a 'double'
Calls: find_inverted_chains ... push.vp.vpTree -> push.vp -> push.vp.viewport -> grid.Call.graphics
Execution halted