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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: networkMA
> ### Title: Contrast-Based Bayesian Network Meta-Analysis Model
> ### Aliases: networkMA
> 
> ### ** Examples
> 
> 
> 
> 
> # This number of MCMC samples is for illustrative purposes only, it may
> # be necessary to increase the total
> ni <- 10000
> nb <- 5000
> nt <- 5
> 
> dat <- smoking # Use the smoking cessation dataset.
> 
> # total number of treatments
> K <- length(unique(dat$tid))
> 
> # Fit model 1
> set.seed(101)
> # Fit the Guassian Effects model.
> m1 <- networkMA(dat, model="gaussian", niter=ni, nburn=nb, nthin=nt,
+                 mb=0, sb=10, md=0, sd=1,
+                 tau_prior = "lognormal", tau_lm = -2.34, tau_lsd = 2,
+                 mh=c(0.5, 0.5, 0.05, 0.5))
> 
> mean(m1$d1[,2])
[1] 0.3956062
> quantile(m1$d1[,2], c(0.025, 0.975))
      2.5%      97.5% 
-0.1752734  0.9893580 
> 
> # Fit the DP Gaussian base measure model.
> m2 <- networkMA(dat, model="dp_gaussian", niter=ni, nburn=nb, nthin=nt,
+                 mb=0, sb=10, md=0, sd=1,
+                 tau_prior = "lognormal", tau_lm = -2.34, tau_lsd = 2,
+                 alpha=1,
+                 mh=c(0.5, 0.5, 0.05, 0.5))
> 
> mean(m2$d1[,2])
[1] 0.5964177
> quantile(m2$d1[,2], c(0.025, 0.975))
       2.5%       97.5% 
-0.06574574  1.02003591 
> 
> 
> # Fit the DP spike and slab base measure model.
> m3 <- networkMA(dat, model="dp_spike_slab", niter=ni, nburn=nb, nthin=nt,
+                 mb=0, sb=10, md=0, sd=1,
+                 tau_prior = "lognormal", tau_lm = -2.34, tau_lsd = 2,
+                 alpha=1, aw=1, bw=1, v0=0.1, scale=1, nu=1,
+                 mh=c(0.5, 0.5, 0.05, 0.5))
> 
> mean(m3$d1[,2])
[1] 0.5110981
> quantile(m3$d1[,2], c(0.025, 0.975))
       2.5%       97.5% 
-0.03322983  1.04003997 
> 
> # Function that finds the graph corresponding to the posterior samples, and
> # graphs for a sequence of threshold probabilities (denoted as gamma in
> # the article)
> 
> gamma_vec <- c(0.5, 0.75, 0.9, 0.95, 0.99)
> networks <- network_graphs(m3[["ordmat"]], gamma=gamma_vec)
> 
> 
> # One way of plotting the directed graph based on the output of the function
> # above is the following.  The "igraph" package can be used to facilitate
> # producing pair-wise graphical model display
> 
> 
> oldpar <- par(no.readonly = TRUE)
> 
> 
> # Plot network that corresponds to posterior mode
> Network = networks[[1]]
> out = cbind(from=1:ncol(Network),to=1:ncol(Network),color=0)
> for(i in 1:(ncol(Network)-1)){
+   for(j in (i+1):ncol(Network)){
+     if(Network[i,j]==1) out = rbind(out,c(i,j,2))
+     if(Network[i,j]==-1)out = rbind(out,c(j,i,2))
+     if(Network[i,j]==0) out = rbind(out,c(i,j,1),c(j,i,1))
+   }
+ }
> 
> 
> mynet <- igraph::graph_from_data_frame(out,directed = TRUE)
Error in loadNamespace(x) : there is no package called ‘igraph’
Calls: loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted