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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: steiner_comparison_plots
> ### Title: Plot simulated data
> ### Aliases: steiner_comparison_plots
> 
> ### ** Examples
> 
> g <- graph("Cubical")
> 
> data <- steiner_simulation(type = c("SP", "KB", "SPM"),
+                            graph = g,
+                            ter_list = generate_st_samples(graph = g,
+                                                           ter_number = c(2, 3),
+                                                           prob = c(0.1, 0.2)))
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
SteinerNet
 --- call from context --- 
steinertree2(optimize = optimize, terminals = terminals, glist = glist, 
    color = color)
 --- call from argument --- 
if (class(t) == "matrix") {
    r <- 1:dim(t)[2]
    t2 <- sapply(r, function(r) min(t[, r]))
}
 --- R stacktrace ---
where 1: steinertree2(optimize = optimize, terminals = terminals, glist = glist, 
    color = color)
where 2: steinertree(type = type, repeattimes = repeattimes, optimize = optimize, 
    terminals = ter_list[[i]], graph = g, color = FALSE, merge = FALSE)
where 3: simulation_tests(type = i, repeattimes, optimize = optimize, 
    glist = glist, ter_list = ter_list)
where 4: steiner_simulation(type = c("SP", "KB", "SPM"), graph = g, ter_list = generate_st_samples(graph = g, 
    ter_number = c(2, 3), prob = c(0.1, 0.2)))

 --- value of length: 2 type: logical ---
[1]  TRUE FALSE
 --- function from context --- 
function (optimize, terminals, glist, color) 
{
    g <- glist[[1]]
    prob <- sample(1:length(terminals), 1)
    subtree <- terminals[[prob]]
    nsubtree <- setdiff(terminals, subtree)
    while (!all(is.element(terminals, intersect(subtree, terminals)))) {
        paths <- lapply(subtree, function(x) get.all.shortest.paths(g, 
            x, nsubtree))
        r <- 1:length(paths)
        t <- sapply(r, function(r) sapply(paths[[r]]$res, length))
        if (class(t) == "list" || class(t) == "integer") {
            r <- 1:length(t)
            t2 <- sapply(r, function(r) min(t[[r]]))
        }
        if (class(t) == "matrix") {
            r <- 1:dim(t)[2]
            t2 <- sapply(r, function(r) min(t[, r]))
        }
        t3 <- which(t2 == min(t2))
        if (length(paths) > 1) {
            if (class(t) == "list" || class(t) == "integer") 
                t4 <- which(t[[t3[1]]] == min(t[[t3[1]]]))
            if (class(t) == "matrix") 
                t4 <- which(t[, t3[1]] == min(t[, t3[1]]))
            found <- names(unlist(paths[[t3[1]]][t4][1]$res))
        }
        else {
            found <- names(unlist(paths[[1]][t3][1]$res))
        }
        subtree <- union(subtree, V(g)[unique(found)]$name)
        nsubtree <- setdiff(nsubtree, V(g)[unique(found)]$name)
    }
    if (optimize) {
        steinert <- minimum.spanning.tree(induced_subgraph(g, 
            subtree))
        a <- V(steinert)$color
        b <- degree(steinert, v = V(steinert), mode = c("all"))
        a1 <- match(a, "yellow")
        b1 <- match(b, "1")
        opt <- sapply(1:length(a1), function(r) a1[r] * b1[r])
        new_g <- delete.vertices(steinert, grep(1, opt))
        steinert <- new_g
    }
    else steinert <- induced_subgraph(g, subtree)
    glst <- c()
    if (color) {
        V(g)[subtree]$color <- "green"
        V(g)[terminals]$color <- "red"
        glst[[length(glst) + 1]] <- g
    }
    glst[[length(glst) + 1]] <- steinert
    return(glst)
}
<bytecode: 0x558b9101d770>
<environment: namespace:SteinerNet>
 --- function search by body ---
Function steinertree2 in namespace SteinerNet has this body.
 ----------- END OF FAILURE REPORT -------------- 
Error in if (class(t) == "matrix") { : the condition has length > 1
Calls: steiner_simulation -> simulation_tests -> steinertree -> steinertree2
Execution halted