CRAN Package Check Results for Package GERGM

Last updated on 2020-03-07 11:48:16 CET.

Flavor Version Tinstall Tcheck Ttotal Status Flags
r-devel-linux-x86_64-debian-clang 0.13.0 103.04 67.89 170.93 ERROR
r-devel-linux-x86_64-debian-gcc 0.13.0 73.64 51.96 125.60 ERROR
r-devel-linux-x86_64-fedora-clang 0.13.0 244.96 ERROR
r-devel-linux-x86_64-fedora-gcc 0.13.0 219.16 ERROR
r-devel-windows-ix86+x86_64 0.13.0 264.00 456.00 720.00 OK
r-devel-windows-ix86+x86_64-gcc8 0.13.0 230.00 380.00 610.00 OK
r-patched-linux-x86_64 0.13.0 82.63 292.68 375.31 OK
r-patched-solaris-x86 0.13.0 799.40 OK
r-release-linux-x86_64 0.13.0 83.18 298.13 381.31 OK
r-release-windows-ix86+x86_64 0.13.0 191.00 330.00 521.00 OK
r-release-osx-x86_64 0.13.0 NOTE
r-oldrel-windows-ix86+x86_64 0.13.0 169.00 360.00 529.00 OK
r-oldrel-osx-x86_64 0.13.0 OK

Check Details

Version: 0.13.0
Check: examples
Result: ERROR
    Running examples in 'GERGM-Ex.R' failed
    The error most likely occurred in:
    
    > base::assign(".ptime", proc.time(), pos = "CheckExEnv")
    > ### Name: plot_network
    > ### Title: Plots of value-edged networks.
    > ### Aliases: plot_network
    >
    > ### ** Examples
    >
    > set.seed(12345)
    > sociomatrix <- matrix(rnorm(400,0,20),20,20)
    > colnames(sociomatrix) <- rownames(sociomatrix) <- letters[1:20]
    > plot_network(sociomatrix)
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
    :
     --- package (from environment) ---
    GERGM
     --- call from context ---
    plot_network(sociomatrix)
     --- call from argument ---
    if (class(sociomatrix) != "matrix" & class(sociomatrix) != "data.frame") {
     stop("You must provide the network as a numeric matrix.")
    }
     --- R stacktrace ---
    where 1: plot_network(sociomatrix)
    
     --- value of length: 2 type: logical ---
    [1] FALSE TRUE
     --- function from context ---
    function (sociomatrix, threshold = 0.5, save_pdf = FALSE, pdf_name = "Test.pdf",
     output_directory = "./", comparison_network = NULL, comparison_names = NULL,
     seed = NULL, white_background = FALSE, show_legend = TRUE,
     title = "", identical_node_positions = FALSE)
    {
     if (!is.null(seed)) {
     set.seed(seed)
     }
     par(mar = c(1, 0, 1, 0))
     if (class(sociomatrix) != "matrix" & class(sociomatrix) !=
     "data.frame") {
     stop("You must provide the network as a numeric matrix.")
     }
     if (nrow(sociomatrix) != ncol(sociomatrix)) {
     stop("You must provide a square matrix.")
     }
     if (white_background) {
     negcolors <- colorRampPalette(c("red", "white"))
     poscolors <- colorRampPalette(c("white", "blue"))
     negcolors <- negcolors(25)
     poscolors <- poscolors(25)
     }
     else {
     negcolors <- colorRampPalette(c("red", "black"))
     poscolors <- colorRampPalette(c("black", "blue"))
     negcolors <- negcolors(25)
     poscolors <- poscolors(25)
     }
     COMPARISON <- FALSE
     if (!is.null(comparison_network)) {
     if (is.null(comparison_names)) {
     comparison_names <- c("", "")
     }
     else {
     if (length(comparison_names) != 2) {
     stop("You must provide a comparison_names object as a vector containing two strings.")
     }
     }
     if (class(comparison_network) != "matrix" & class(comparison_network) !=
     "data.frame") {
     stop("You must provide the network as a numeric matrix.")
     }
     if (nrow(comparison_network) != ncol(comparison_network)) {
     stop("You must provide a square matrix.")
     }
     if (nrow(comparison_network) != nrow(sociomatrix)) {
     stop("You must provide two matrices with the same dimensions.")
     }
     COMPARISON <- TRUE
     diag(comparison_network) <- 0
     temp <- temp2 <- matrix(comparison_network[, ], nrow(comparison_network),
     ncol(comparison_network))
     cutoff <- max(abs(temp)) * threshold
     temp[which(abs(temp) < cutoff)] <- 0
     net3 <- igraph::graph.adjacency(temp, mode = "directed",
     weighted = TRUE, diag = FALSE)
     layout_c <- igraph::layout_with_fr(net3, weights = igraph::E(net3)$weight)
     net4 <- igraph::graph.adjacency(temp2, mode = "directed",
     weighted = TRUE, diag = FALSE)
     edgelist_c <- igraph::get.edgelist(net4)
     weights_c <- igraph::E(net4)$weight
     ordering <- order(abs(weights_c), decreasing = F)
     edgelist_c <- edgelist_c[ordering, ]
     weights_c <- weights_c[ordering]
     }
     diag(sociomatrix) <- 0
     temp <- temp2 <- matrix(sociomatrix[, ], nrow(sociomatrix),
     ncol(sociomatrix))
     cutoff <- max(abs(temp)) * threshold
     temp[which(abs(temp) < cutoff)] <- 0
     net <- igraph::graph.adjacency(temp, mode = "directed", weighted = TRUE,
     diag = FALSE)
     layout <- igraph::layout_with_fr(net, weights = igraph::E(net)$weight)
     net2 <- igraph::graph.adjacency(temp2, mode = "directed",
     weighted = TRUE, diag = FALSE)
     edgelist <- igraph::get.edgelist(net2)
     weights <- igraph::E(net2)$weight
     ordering <- order(abs(weights), decreasing = F)
     edgelist <- edgelist[ordering, ]
     weights <- weights[ordering]
     negbreaks <- seq(-max(abs(weights)), 0, length.out = 26)
     posbreaks <- seq(0, max(abs(weights)), length.out = 26)
     widbreaks <- seq(0, max(abs(weights)), length.out = 50)
     widths <- seq(0, 5, length.out = 50)
     if (COMPARISON) {
     negbreaks <- seq(-max(abs(c(weights, weights_c))), 0,
     length.out = 26)
     posbreaks <- seq(0, max(abs(c(weights, weights_c))),
     length.out = 26)
     widbreaks <- seq(0, max(abs(c(weights, weights_c))),
     length.out = 50)
     widths <- seq(0, 5, length.out = 50)
     }
     if (COMPARISON) {
     if (identical_node_positions) {
     layout_c <- layout
     }
     else {
     layout_c <- vegan::procrustes(layout, layout_c, scale = F)$Yrot
     }
     }
     if (save_pdf) {
     cur_directory <- getwd()
     setwd(output_directory)
     if (COMPARISON) {
     pdf(file = pdf_name, width = 24, height = 12)
     if (white_background) {
     par(bg = "white", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "black", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     else {
     par(bg = "black", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "white", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     max_bin <- 1
     min_bin <- 1
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin) {
     max_bin <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin) {
     min_bin <- bin
     }
     }
     }
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "white", text.col = "black", box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "black", text.col = "white")
     }
     }
     if (white_background) {
     plot(layout_c, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "black", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     else {
     plot(layout_c, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "white", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     max_bin_c <- 1
     min_bin_c <- 1
     for (i in 1:length(weights_c)) {
     cur1 <- layout_c[edgelist_c[i, 1], ]
     cur2 <- layout_c[edgelist_c[i, 2], ]
     curweight <- weights_c[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin_c) {
     max_bin_c <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin_c) {
     min_bin_c <- bin
     }
     }
     }
     if (white_background) {
     text(layout_c, labels = rownames(comparison_network),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout_c, labels = rownames(comparison_network),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "black", text.col = "white")
     }
     }
     dev.off()
     }
     else {
     pdf(file = pdf_name, width = 12, height = 12)
     if (white_background) {
     par(bg = "white", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 2), (max(layout[,
     1]) + 2)), ylim = c((min(layout[, 2]) - 2),
     (max(layout[, 2]) + 2)))
     }
     else {
     par(bg = "black", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 2), (max(layout[,
     1]) + 2)), ylim = c((min(layout[, 2]) - 2),
     (max(layout[, 2]) + 2)))
     }
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     }
     }
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "black", text.col = "white")
     }
     }
     dev.off()
     }
     setwd(cur_directory)
     }
     else {
     if (COMPARISON) {
     if (white_background) {
     par(bg = "white", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "black", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     else {
     par(bg = "black", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "white", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     max_bin <- 1
     min_bin <- 1
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin) {
     max_bin <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin) {
     min_bin <- bin
     }
     }
     }
     print(max_bin)
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "white", text.col = "black", box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "black", text.col = "white")
     }
     }
     if (white_background) {
     plot(layout_c, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "black", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     else {
     plot(layout_c, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "white", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     max_bin_c <- 1
     min_bin_c <- 1
     for (i in 1:length(weights_c)) {
     cur1 <- layout_c[edgelist_c[i, 1], ]
     cur2 <- layout_c[edgelist_c[i, 2], ]
     curweight <- weights_c[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin_c) {
     max_bin_c <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin_c) {
     min_bin_c <- bin
     }
     }
     }
     if (white_background) {
     text(layout_c, labels = rownames(comparison_network),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout_c, labels = rownames(comparison_network),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "black", text.col = "white")
     }
     }
     }
     else {
     if (white_background) {
     par(bg = "white", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 0.2), (max(layout[,
     1]) + 0.2)), ylim = c((min(layout[, 2]) -
     0.2), (max(layout[, 2]) + 0.2)))
     }
     else {
     par(bg = "black", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 0.2), (max(layout[,
     1]) + 0.2)), ylim = c((min(layout[, 2]) -
     0.2), (max(layout[, 2]) + 0.2)))
     }
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     }
     }
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "black", text.col = "white")
     }
     }
     }
     }
     par(bg = "white")
    }
    <bytecode: 0x48b3fc0>
    <environment: namespace:GERGM>
     --- function search by body ---
    Function plot_network in namespace GERGM has this body.
     ----------- END OF FAILURE REPORT --------------
    Error in if (class(sociomatrix) != "matrix" & class(sociomatrix) != "data.frame") { :
     the condition has length > 1
    Calls: plot_network
    Execution halted
Flavor: r-devel-linux-x86_64-debian-clang

Version: 0.13.0
Check: re-building of vignette outputs
Result: WARN
    Error(s) in re-building vignettes:
     ...
    --- re-building 'getting_started.Rmd' using rmarkdown
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
    :
     --- package (from environment) ---
    GERGM
     --- call from context ---
    plot_network(lending_2005)
     --- call from argument ---
    if (class(sociomatrix) != "matrix" & class(sociomatrix) != "data.frame") {
     stop("You must provide the network as a numeric matrix.")
    }
     --- R stacktrace ---
    where 1: plot_network(lending_2005)
    where 2: eval(expr, envir, enclos)
    where 3: eval(expr, envir, enclos)
    where 4: withVisible(eval(expr, envir, enclos))
    where 5: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler,
     error = eHandler, message = mHandler)
    where 6: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir,
     enclos)), warning = wHandler, error = eHandler, message = mHandler))
    where 7: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr,
     envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))
    where 8: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,
     debug = debug, last = i == length(out), use_try = stop_on_error !=
     2L, keep_warning = keep_warning, keep_message = keep_message,
     output_handler = output_handler, include_timing = include_timing)
    where 9: evaluate::evaluate(...)
    where 10: evaluate(code, envir = env, new_device = FALSE, keep_warning = !isFALSE(options$warning),
     keep_message = !isFALSE(options$message), stop_on_error = if (options$error &&
     options$include) 0L else 2L, output_handler = knit_handlers(options$render,
     options))
    where 11: in_dir(input_dir(), evaluate(code, envir = env, new_device = FALSE,
     keep_warning = !isFALSE(options$warning), keep_message = !isFALSE(options$message),
     stop_on_error = if (options$error && options$include) 0L else 2L,
     output_handler = knit_handlers(options$render, options)))
    where 12: block_exec(params)
    where 13: call_block(x)
    where 14: process_group.block(group)
    where 15: process_group(group)
    where 16: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),
     error = function(e) {
     setwd(wd)
     cat(res, sep = "\n", file = output %n% "")
     message("Quitting from lines ", paste(current_lines(i),
     collapse = "-"), " (", knit_concord$get("infile"),
     ") ")
     })
    where 17: process_file(text, output)
    where 18: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
    where 19: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(),
     output_dir = getwd(), ...)
    where 20: vweave_rmarkdown(...)
    where 21: engine$weave(file, quiet = quiet, encoding = enc)
    where 22: doTryCatch(return(expr), name, parentenv, handler)
    where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
    where 24: tryCatchList(expr, classes, parentenv, handlers)
    where 25: tryCatch({
     engine$weave(file, quiet = quiet, encoding = enc)
     setwd(startdir)
     output <- find_vignette_product(name, by = "weave", engine = engine)
     if (!have.makefile && vignette_is_tex(output)) {
     texi2pdf(file = output, clean = FALSE, quiet = quiet)
     output <- find_vignette_product(name, by = "texi2pdf",
     engine = engine)
     }
     outputs <- c(outputs, output)
    }, error = function(e) {
     thisOK <<- FALSE
     fails <<- c(fails, file)
     message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s",
     file, conditionMessage(e)))
    })
    where 26: tools:::buildVignettes(dir = "/home/hornik/tmp/R.check/r-devel-clang/Work/PKGS/GERGM.Rcheck/vign_test/GERGM",
     ser_elibs = "/tmp/RtmpxjYXzC/file17c22425b27a.rds")
    
     --- value of length: 2 type: logical ---
    [1] FALSE TRUE
     --- function from context ---
    function (sociomatrix, threshold = 0.5, save_pdf = FALSE, pdf_name = "Test.pdf",
     output_directory = "./", comparison_network = NULL, comparison_names = NULL,
     seed = NULL, white_background = FALSE, show_legend = TRUE,
     title = "", identical_node_positions = FALSE)
    {
     if (!is.null(seed)) {
     set.seed(seed)
     }
     par(mar = c(1, 0, 1, 0))
     if (class(sociomatrix) != "matrix" & class(sociomatrix) !=
     "data.frame") {
     stop("You must provide the network as a numeric matrix.")
     }
     if (nrow(sociomatrix) != ncol(sociomatrix)) {
     stop("You must provide a square matrix.")
     }
     if (white_background) {
     negcolors <- colorRampPalette(c("red", "white"))
     poscolors <- colorRampPalette(c("white", "blue"))
     negcolors <- negcolors(25)
     poscolors <- poscolors(25)
     }
     else {
     negcolors <- colorRampPalette(c("red", "black"))
     poscolors <- colorRampPalette(c("black", "blue"))
     negcolors <- negcolors(25)
     poscolors <- poscolors(25)
     }
     COMPARISON <- FALSE
     if (!is.null(comparison_network)) {
     if (is.null(comparison_names)) {
     comparison_names <- c("", "")
     }
     else {
     if (length(comparison_names) != 2) {
     stop("You must provide a comparison_names object as a vector containing two strings.")
     }
     }
     if (class(comparison_network) != "matrix" & class(comparison_network) !=
     "data.frame") {
     stop("You must provide the network as a numeric matrix.")
     }
     if (nrow(comparison_network) != ncol(comparison_network)) {
     stop("You must provide a square matrix.")
     }
     if (nrow(comparison_network) != nrow(sociomatrix)) {
     stop("You must provide two matrices with the same dimensions.")
     }
     COMPARISON <- TRUE
     diag(comparison_network) <- 0
     temp <- temp2 <- matrix(comparison_network[, ], nrow(comparison_network),
     ncol(comparison_network))
     cutoff <- max(abs(temp)) * threshold
     temp[which(abs(temp) < cutoff)] <- 0
     net3 <- igraph::graph.adjacency(temp, mode = "directed",
     weighted = TRUE, diag = FALSE)
     layout_c <- igraph::layout_with_fr(net3, weights = igraph::E(net3)$weight)
     net4 <- igraph::graph.adjacency(temp2, mode = "directed",
     weighted = TRUE, diag = FALSE)
     edgelist_c <- igraph::get.edgelist(net4)
     weights_c <- igraph::E(net4)$weight
     ordering <- order(abs(weights_c), decreasing = F)
     edgelist_c <- edgelist_c[ordering, ]
     weights_c <- weights_c[ordering]
     }
     diag(sociomatrix) <- 0
     temp <- temp2 <- matrix(sociomatrix[, ], nrow(sociomatrix),
     ncol(sociomatrix))
     cutoff <- max(abs(temp)) * threshold
     temp[which(abs(temp) < cutoff)] <- 0
     net <- igraph::graph.adjacency(temp, mode = "directed", weighted = TRUE,
     diag = FALSE)
     layout <- igraph::layout_with_fr(net, weights = igraph::E(net)$weight)
     net2 <- igraph::graph.adjacency(temp2, mode = "directed",
     weighted = TRUE, diag = FALSE)
     edgelist <- igraph::get.edgelist(net2)
     weights <- igraph::E(net2)$weight
     ordering <- order(abs(weights), decreasing = F)
     edgelist <- edgelist[ordering, ]
     weights <- weights[ordering]
     negbreaks <- seq(-max(abs(weights)), 0, length.out = 26)
     posbreaks <- seq(0, max(abs(weights)), length.out = 26)
     widbreaks <- seq(0, max(abs(weights)), length.out = 50)
     widths <- seq(0, 5, length.out = 50)
     if (COMPARISON) {
     negbreaks <- seq(-max(abs(c(weights, weights_c))), 0,
     length.out = 26)
     posbreaks <- seq(0, max(abs(c(weights, weights_c))),
     length.out = 26)
     widbreaks <- seq(0, max(abs(c(weights, weights_c))),
     length.out = 50)
     widths <- seq(0, 5, length.out = 50)
     }
     if (COMPARISON) {
     if (identical_node_positions) {
     layout_c <- layout
     }
     else {
     layout_c <- vegan::procrustes(layout, layout_c, scale = F)$Yrot
     }
     }
     if (save_pdf) {
     cur_directory <- getwd()
     setwd(output_directory)
     if (COMPARISON) {
     pdf(file = pdf_name, width = 24, height = 12)
     if (white_background) {
     par(bg = "white", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "black", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     else {
     par(bg = "black", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "white", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     max_bin <- 1
     min_bin <- 1
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin) {
     max_bin <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin) {
     min_bin <- bin
     }
     }
     }
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "white", text.col = "black", box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "black", text.col = "white")
     }
     }
     if (white_background) {
     plot(layout_c, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "black", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     else {
     plot(layout_c, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "white", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     max_bin_c <- 1
     min_bin_c <- 1
     for (i in 1:length(weights_c)) {
     cur1 <- layout_c[edgelist_c[i, 1], ]
     cur2 <- layout_c[edgelist_c[i, 2], ]
     curweight <- weights_c[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin_c) {
     max_bin_c <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin_c) {
     min_bin_c <- bin
     }
     }
     }
     if (white_background) {
     text(layout_c, labels = rownames(comparison_network),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout_c, labels = rownames(comparison_network),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "black", text.col = "white")
     }
     }
     dev.off()
     }
     else {
     pdf(file = pdf_name, width = 12, height = 12)
     if (white_background) {
     par(bg = "white", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 2), (max(layout[,
     1]) + 2)), ylim = c((min(layout[, 2]) - 2),
     (max(layout[, 2]) + 2)))
     }
     else {
     par(bg = "black", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 2), (max(layout[,
     1]) + 2)), ylim = c((min(layout[, 2]) - 2),
     (max(layout[, 2]) + 2)))
     }
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     }
     }
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "black", text.col = "white")
     }
     }
     dev.off()
     }
     setwd(cur_directory)
     }
     else {
     if (COMPARISON) {
     if (white_background) {
     par(bg = "white", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "black", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     else {
     par(bg = "black", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "white", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     max_bin <- 1
     min_bin <- 1
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin) {
     max_bin <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin) {
     min_bin <- bin
     }
     }
     }
     print(max_bin)
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "white", text.col = "black", box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "black", text.col = "white")
     }
     }
     if (white_background) {
     plot(layout_c, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "black", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     else {
     plot(layout_c, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "white", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     max_bin_c <- 1
     min_bin_c <- 1
     for (i in 1:length(weights_c)) {
     cur1 <- layout_c[edgelist_c[i, 1], ]
     cur2 <- layout_c[edgelist_c[i, 2], ]
     curweight <- weights_c[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin_c) {
     max_bin_c <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin_c) {
     min_bin_c <- bin
     }
     }
     }
     if (white_background) {
     text(layout_c, labels = rownames(comparison_network),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout_c, labels = rownames(comparison_network),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "black", text.col = "white")
     }
     }
     }
     else {
     if (white_background) {
     par(bg = "white", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 0.2), (max(layout[,
     1]) + 0.2)), ylim = c((min(layout[, 2]) -
     0.2), (max(layout[, 2]) + 0.2)))
     }
     else {
     par(bg = "black", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 0.2), (max(layout[,
     1]) + 0.2)), ylim = c((min(layout[, 2]) -
     0.2), (max(layout[, 2]) + 0.2)))
     }
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     }
     }
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "black", text.col = "white")
     }
     }
     }
     }
     par(bg = "white")
    }
    <bytecode: 0x3a0f4c8>
    <environment: namespace:GERGM>
     --- function search by body ---
    Function plot_network in namespace GERGM has this body.
     ----------- END OF FAILURE REPORT --------------
    Quitting from lines 96-102 (getting_started.Rmd)
    Error: processing vignette 'getting_started.Rmd' failed with diagnostics:
    the condition has length > 1
    --- failed re-building 'getting_started.Rmd'
    
    SUMMARY: processing the following file failed:
     'getting_started.Rmd'
    
    Error: Vignette re-building failed.
    Execution halted
Flavor: r-devel-linux-x86_64-debian-clang

Version: 0.13.0
Check: examples
Result: ERROR
    Running examples in ‘GERGM-Ex.R’ failed
    The error most likely occurred in:
    
    > base::assign(".ptime", proc.time(), pos = "CheckExEnv")
    > ### Name: plot_network
    > ### Title: Plots of value-edged networks.
    > ### Aliases: plot_network
    >
    > ### ** Examples
    >
    > set.seed(12345)
    > sociomatrix <- matrix(rnorm(400,0,20),20,20)
    > colnames(sociomatrix) <- rownames(sociomatrix) <- letters[1:20]
    > plot_network(sociomatrix)
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
    :
     --- package (from environment) ---
    GERGM
     --- call from context ---
    plot_network(sociomatrix)
     --- call from argument ---
    if (class(sociomatrix) != "matrix" & class(sociomatrix) != "data.frame") {
     stop("You must provide the network as a numeric matrix.")
    }
     --- R stacktrace ---
    where 1: plot_network(sociomatrix)
    
     --- value of length: 2 type: logical ---
    [1] FALSE TRUE
     --- function from context ---
    function (sociomatrix, threshold = 0.5, save_pdf = FALSE, pdf_name = "Test.pdf",
     output_directory = "./", comparison_network = NULL, comparison_names = NULL,
     seed = NULL, white_background = FALSE, show_legend = TRUE,
     title = "", identical_node_positions = FALSE)
    {
     if (!is.null(seed)) {
     set.seed(seed)
     }
     par(mar = c(1, 0, 1, 0))
     if (class(sociomatrix) != "matrix" & class(sociomatrix) !=
     "data.frame") {
     stop("You must provide the network as a numeric matrix.")
     }
     if (nrow(sociomatrix) != ncol(sociomatrix)) {
     stop("You must provide a square matrix.")
     }
     if (white_background) {
     negcolors <- colorRampPalette(c("red", "white"))
     poscolors <- colorRampPalette(c("white", "blue"))
     negcolors <- negcolors(25)
     poscolors <- poscolors(25)
     }
     else {
     negcolors <- colorRampPalette(c("red", "black"))
     poscolors <- colorRampPalette(c("black", "blue"))
     negcolors <- negcolors(25)
     poscolors <- poscolors(25)
     }
     COMPARISON <- FALSE
     if (!is.null(comparison_network)) {
     if (is.null(comparison_names)) {
     comparison_names <- c("", "")
     }
     else {
     if (length(comparison_names) != 2) {
     stop("You must provide a comparison_names object as a vector containing two strings.")
     }
     }
     if (class(comparison_network) != "matrix" & class(comparison_network) !=
     "data.frame") {
     stop("You must provide the network as a numeric matrix.")
     }
     if (nrow(comparison_network) != ncol(comparison_network)) {
     stop("You must provide a square matrix.")
     }
     if (nrow(comparison_network) != nrow(sociomatrix)) {
     stop("You must provide two matrices with the same dimensions.")
     }
     COMPARISON <- TRUE
     diag(comparison_network) <- 0
     temp <- temp2 <- matrix(comparison_network[, ], nrow(comparison_network),
     ncol(comparison_network))
     cutoff <- max(abs(temp)) * threshold
     temp[which(abs(temp) < cutoff)] <- 0
     net3 <- igraph::graph.adjacency(temp, mode = "directed",
     weighted = TRUE, diag = FALSE)
     layout_c <- igraph::layout_with_fr(net3, weights = igraph::E(net3)$weight)
     net4 <- igraph::graph.adjacency(temp2, mode = "directed",
     weighted = TRUE, diag = FALSE)
     edgelist_c <- igraph::get.edgelist(net4)
     weights_c <- igraph::E(net4)$weight
     ordering <- order(abs(weights_c), decreasing = F)
     edgelist_c <- edgelist_c[ordering, ]
     weights_c <- weights_c[ordering]
     }
     diag(sociomatrix) <- 0
     temp <- temp2 <- matrix(sociomatrix[, ], nrow(sociomatrix),
     ncol(sociomatrix))
     cutoff <- max(abs(temp)) * threshold
     temp[which(abs(temp) < cutoff)] <- 0
     net <- igraph::graph.adjacency(temp, mode = "directed", weighted = TRUE,
     diag = FALSE)
     layout <- igraph::layout_with_fr(net, weights = igraph::E(net)$weight)
     net2 <- igraph::graph.adjacency(temp2, mode = "directed",
     weighted = TRUE, diag = FALSE)
     edgelist <- igraph::get.edgelist(net2)
     weights <- igraph::E(net2)$weight
     ordering <- order(abs(weights), decreasing = F)
     edgelist <- edgelist[ordering, ]
     weights <- weights[ordering]
     negbreaks <- seq(-max(abs(weights)), 0, length.out = 26)
     posbreaks <- seq(0, max(abs(weights)), length.out = 26)
     widbreaks <- seq(0, max(abs(weights)), length.out = 50)
     widths <- seq(0, 5, length.out = 50)
     if (COMPARISON) {
     negbreaks <- seq(-max(abs(c(weights, weights_c))), 0,
     length.out = 26)
     posbreaks <- seq(0, max(abs(c(weights, weights_c))),
     length.out = 26)
     widbreaks <- seq(0, max(abs(c(weights, weights_c))),
     length.out = 50)
     widths <- seq(0, 5, length.out = 50)
     }
     if (COMPARISON) {
     if (identical_node_positions) {
     layout_c <- layout
     }
     else {
     layout_c <- vegan::procrustes(layout, layout_c, scale = F)$Yrot
     }
     }
     if (save_pdf) {
     cur_directory <- getwd()
     setwd(output_directory)
     if (COMPARISON) {
     pdf(file = pdf_name, width = 24, height = 12)
     if (white_background) {
     par(bg = "white", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "black", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     else {
     par(bg = "black", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "white", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     max_bin <- 1
     min_bin <- 1
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin) {
     max_bin <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin) {
     min_bin <- bin
     }
     }
     }
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "white", text.col = "black", box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "black", text.col = "white")
     }
     }
     if (white_background) {
     plot(layout_c, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "black", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     else {
     plot(layout_c, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "white", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     max_bin_c <- 1
     min_bin_c <- 1
     for (i in 1:length(weights_c)) {
     cur1 <- layout_c[edgelist_c[i, 1], ]
     cur2 <- layout_c[edgelist_c[i, 2], ]
     curweight <- weights_c[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin_c) {
     max_bin_c <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin_c) {
     min_bin_c <- bin
     }
     }
     }
     if (white_background) {
     text(layout_c, labels = rownames(comparison_network),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout_c, labels = rownames(comparison_network),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "black", text.col = "white")
     }
     }
     dev.off()
     }
     else {
     pdf(file = pdf_name, width = 12, height = 12)
     if (white_background) {
     par(bg = "white", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 2), (max(layout[,
     1]) + 2)), ylim = c((min(layout[, 2]) - 2),
     (max(layout[, 2]) + 2)))
     }
     else {
     par(bg = "black", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 2), (max(layout[,
     1]) + 2)), ylim = c((min(layout[, 2]) - 2),
     (max(layout[, 2]) + 2)))
     }
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     }
     }
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "black", text.col = "white")
     }
     }
     dev.off()
     }
     setwd(cur_directory)
     }
     else {
     if (COMPARISON) {
     if (white_background) {
     par(bg = "white", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "black", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     else {
     par(bg = "black", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "white", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     max_bin <- 1
     min_bin <- 1
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin) {
     max_bin <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin) {
     min_bin <- bin
     }
     }
     }
     print(max_bin)
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "white", text.col = "black", box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "black", text.col = "white")
     }
     }
     if (white_background) {
     plot(layout_c, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "black", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     else {
     plot(layout_c, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "white", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     max_bin_c <- 1
     min_bin_c <- 1
     for (i in 1:length(weights_c)) {
     cur1 <- layout_c[edgelist_c[i, 1], ]
     cur2 <- layout_c[edgelist_c[i, 2], ]
     curweight <- weights_c[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin_c) {
     max_bin_c <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin_c) {
     min_bin_c <- bin
     }
     }
     }
     if (white_background) {
     text(layout_c, labels = rownames(comparison_network),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout_c, labels = rownames(comparison_network),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "black", text.col = "white")
     }
     }
     }
     else {
     if (white_background) {
     par(bg = "white", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 0.2), (max(layout[,
     1]) + 0.2)), ylim = c((min(layout[, 2]) -
     0.2), (max(layout[, 2]) + 0.2)))
     }
     else {
     par(bg = "black", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 0.2), (max(layout[,
     1]) + 0.2)), ylim = c((min(layout[, 2]) -
     0.2), (max(layout[, 2]) + 0.2)))
     }
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     }
     }
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "black", text.col = "white")
     }
     }
     }
     }
     par(bg = "white")
    }
    <bytecode: 0x5565aee0e850>
    <environment: namespace:GERGM>
     --- function search by body ---
    Function plot_network in namespace GERGM has this body.
     ----------- END OF FAILURE REPORT --------------
    Error in if (class(sociomatrix) != "matrix" & class(sociomatrix) != "data.frame") { :
     the condition has length > 1
    Calls: plot_network
    Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc

Version: 0.13.0
Check: re-building of vignette outputs
Result: WARN
    Error(s) in re-building vignettes:
     ...
    --- re-building ‘getting_started.Rmd’ using rmarkdown
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
    :
     --- package (from environment) ---
    GERGM
     --- call from context ---
    plot_network(lending_2005)
     --- call from argument ---
    if (class(sociomatrix) != "matrix" & class(sociomatrix) != "data.frame") {
     stop("You must provide the network as a numeric matrix.")
    }
     --- R stacktrace ---
    where 1: plot_network(lending_2005)
    where 2: eval(expr, envir, enclos)
    where 3: eval(expr, envir, enclos)
    where 4: withVisible(eval(expr, envir, enclos))
    where 5: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler,
     error = eHandler, message = mHandler)
    where 6: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir,
     enclos)), warning = wHandler, error = eHandler, message = mHandler))
    where 7: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr,
     envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))
    where 8: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,
     debug = debug, last = i == length(out), use_try = stop_on_error !=
     2L, keep_warning = keep_warning, keep_message = keep_message,
     output_handler = output_handler, include_timing = include_timing)
    where 9: evaluate::evaluate(...)
    where 10: evaluate(code, envir = env, new_device = FALSE, keep_warning = !isFALSE(options$warning),
     keep_message = !isFALSE(options$message), stop_on_error = if (options$error &&
     options$include) 0L else 2L, output_handler = knit_handlers(options$render,
     options))
    where 11: in_dir(input_dir(), evaluate(code, envir = env, new_device = FALSE,
     keep_warning = !isFALSE(options$warning), keep_message = !isFALSE(options$message),
     stop_on_error = if (options$error && options$include) 0L else 2L,
     output_handler = knit_handlers(options$render, options)))
    where 12: block_exec(params)
    where 13: call_block(x)
    where 14: process_group.block(group)
    where 15: process_group(group)
    where 16: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),
     error = function(e) {
     setwd(wd)
     cat(res, sep = "\n", file = output %n% "")
     message("Quitting from lines ", paste(current_lines(i),
     collapse = "-"), " (", knit_concord$get("infile"),
     ") ")
     })
    where 17: process_file(text, output)
    where 18: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
    where 19: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(),
     output_dir = getwd(), ...)
    where 20: vweave_rmarkdown(...)
    where 21: engine$weave(file, quiet = quiet, encoding = enc)
    where 22: doTryCatch(return(expr), name, parentenv, handler)
    where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
    where 24: tryCatchList(expr, classes, parentenv, handlers)
    where 25: tryCatch({
     engine$weave(file, quiet = quiet, encoding = enc)
     setwd(startdir)
     output <- find_vignette_product(name, by = "weave", engine = engine)
     if (!have.makefile && vignette_is_tex(output)) {
     texi2pdf(file = output, clean = FALSE, quiet = quiet)
     output <- find_vignette_product(name, by = "texi2pdf",
     engine = engine)
     }
     outputs <- c(outputs, output)
    }, error = function(e) {
     thisOK <<- FALSE
     fails <<- c(fails, file)
     message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s",
     file, conditionMessage(e)))
    })
    where 26: tools:::buildVignettes(dir = "/home/hornik/tmp/R.check/r-devel-gcc/Work/PKGS/GERGM.Rcheck/vign_test/GERGM",
     ser_elibs = "/home/hornik/tmp/scratch/Rtmpq29Hvt/file12813e5609d8.rds")
    
     --- value of length: 2 type: logical ---
    [1] FALSE TRUE
     --- function from context ---
    function (sociomatrix, threshold = 0.5, save_pdf = FALSE, pdf_name = "Test.pdf",
     output_directory = "./", comparison_network = NULL, comparison_names = NULL,
     seed = NULL, white_background = FALSE, show_legend = TRUE,
     title = "", identical_node_positions = FALSE)
    {
     if (!is.null(seed)) {
     set.seed(seed)
     }
     par(mar = c(1, 0, 1, 0))
     if (class(sociomatrix) != "matrix" & class(sociomatrix) !=
     "data.frame") {
     stop("You must provide the network as a numeric matrix.")
     }
     if (nrow(sociomatrix) != ncol(sociomatrix)) {
     stop("You must provide a square matrix.")
     }
     if (white_background) {
     negcolors <- colorRampPalette(c("red", "white"))
     poscolors <- colorRampPalette(c("white", "blue"))
     negcolors <- negcolors(25)
     poscolors <- poscolors(25)
     }
     else {
     negcolors <- colorRampPalette(c("red", "black"))
     poscolors <- colorRampPalette(c("black", "blue"))
     negcolors <- negcolors(25)
     poscolors <- poscolors(25)
     }
     COMPARISON <- FALSE
     if (!is.null(comparison_network)) {
     if (is.null(comparison_names)) {
     comparison_names <- c("", "")
     }
     else {
     if (length(comparison_names) != 2) {
     stop("You must provide a comparison_names object as a vector containing two strings.")
     }
     }
     if (class(comparison_network) != "matrix" & class(comparison_network) !=
     "data.frame") {
     stop("You must provide the network as a numeric matrix.")
     }
     if (nrow(comparison_network) != ncol(comparison_network)) {
     stop("You must provide a square matrix.")
     }
     if (nrow(comparison_network) != nrow(sociomatrix)) {
     stop("You must provide two matrices with the same dimensions.")
     }
     COMPARISON <- TRUE
     diag(comparison_network) <- 0
     temp <- temp2 <- matrix(comparison_network[, ], nrow(comparison_network),
     ncol(comparison_network))
     cutoff <- max(abs(temp)) * threshold
     temp[which(abs(temp) < cutoff)] <- 0
     net3 <- igraph::graph.adjacency(temp, mode = "directed",
     weighted = TRUE, diag = FALSE)
     layout_c <- igraph::layout_with_fr(net3, weights = igraph::E(net3)$weight)
     net4 <- igraph::graph.adjacency(temp2, mode = "directed",
     weighted = TRUE, diag = FALSE)
     edgelist_c <- igraph::get.edgelist(net4)
     weights_c <- igraph::E(net4)$weight
     ordering <- order(abs(weights_c), decreasing = F)
     edgelist_c <- edgelist_c[ordering, ]
     weights_c <- weights_c[ordering]
     }
     diag(sociomatrix) <- 0
     temp <- temp2 <- matrix(sociomatrix[, ], nrow(sociomatrix),
     ncol(sociomatrix))
     cutoff <- max(abs(temp)) * threshold
     temp[which(abs(temp) < cutoff)] <- 0
     net <- igraph::graph.adjacency(temp, mode = "directed", weighted = TRUE,
     diag = FALSE)
     layout <- igraph::layout_with_fr(net, weights = igraph::E(net)$weight)
     net2 <- igraph::graph.adjacency(temp2, mode = "directed",
     weighted = TRUE, diag = FALSE)
     edgelist <- igraph::get.edgelist(net2)
     weights <- igraph::E(net2)$weight
     ordering <- order(abs(weights), decreasing = F)
     edgelist <- edgelist[ordering, ]
     weights <- weights[ordering]
     negbreaks <- seq(-max(abs(weights)), 0, length.out = 26)
     posbreaks <- seq(0, max(abs(weights)), length.out = 26)
     widbreaks <- seq(0, max(abs(weights)), length.out = 50)
     widths <- seq(0, 5, length.out = 50)
     if (COMPARISON) {
     negbreaks <- seq(-max(abs(c(weights, weights_c))), 0,
     length.out = 26)
     posbreaks <- seq(0, max(abs(c(weights, weights_c))),
     length.out = 26)
     widbreaks <- seq(0, max(abs(c(weights, weights_c))),
     length.out = 50)
     widths <- seq(0, 5, length.out = 50)
     }
     if (COMPARISON) {
     if (identical_node_positions) {
     layout_c <- layout
     }
     else {
     layout_c <- vegan::procrustes(layout, layout_c, scale = F)$Yrot
     }
     }
     if (save_pdf) {
     cur_directory <- getwd()
     setwd(output_directory)
     if (COMPARISON) {
     pdf(file = pdf_name, width = 24, height = 12)
     if (white_background) {
     par(bg = "white", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "black", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     else {
     par(bg = "black", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "white", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     max_bin <- 1
     min_bin <- 1
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin) {
     max_bin <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin) {
     min_bin <- bin
     }
     }
     }
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "white", text.col = "black", box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "black", text.col = "white")
     }
     }
     if (white_background) {
     plot(layout_c, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "black", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     else {
     plot(layout_c, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "white", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     max_bin_c <- 1
     min_bin_c <- 1
     for (i in 1:length(weights_c)) {
     cur1 <- layout_c[edgelist_c[i, 1], ]
     cur2 <- layout_c[edgelist_c[i, 2], ]
     curweight <- weights_c[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin_c) {
     max_bin_c <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin_c) {
     min_bin_c <- bin
     }
     }
     }
     if (white_background) {
     text(layout_c, labels = rownames(comparison_network),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout_c, labels = rownames(comparison_network),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "black", text.col = "white")
     }
     }
     dev.off()
     }
     else {
     pdf(file = pdf_name, width = 12, height = 12)
     if (white_background) {
     par(bg = "white", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 2), (max(layout[,
     1]) + 2)), ylim = c((min(layout[, 2]) - 2),
     (max(layout[, 2]) + 2)))
     }
     else {
     par(bg = "black", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 2), (max(layout[,
     1]) + 2)), ylim = c((min(layout[, 2]) - 2),
     (max(layout[, 2]) + 2)))
     }
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     }
     }
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "black", text.col = "white")
     }
     }
     dev.off()
     }
     setwd(cur_directory)
     }
     else {
     if (COMPARISON) {
     if (white_background) {
     par(bg = "white", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "black", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     else {
     par(bg = "black", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "white", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     max_bin <- 1
     min_bin <- 1
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin) {
     max_bin <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin) {
     min_bin <- bin
     }
     }
     }
     print(max_bin)
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "white", text.col = "black", box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "black", text.col = "white")
     }
     }
     if (white_background) {
     plot(layout_c, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "black", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     else {
     plot(layout_c, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "white", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     max_bin_c <- 1
     min_bin_c <- 1
     for (i in 1:length(weights_c)) {
     cur1 <- layout_c[edgelist_c[i, 1], ]
     cur2 <- layout_c[edgelist_c[i, 2], ]
     curweight <- weights_c[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin_c) {
     max_bin_c <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin_c) {
     min_bin_c <- bin
     }
     }
     }
     if (white_background) {
     text(layout_c, labels = rownames(comparison_network),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout_c, labels = rownames(comparison_network),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "black", text.col = "white")
     }
     }
     }
     else {
     if (white_background) {
     par(bg = "white", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 0.2), (max(layout[,
     1]) + 0.2)), ylim = c((min(layout[, 2]) -
     0.2), (max(layout[, 2]) + 0.2)))
     }
     else {
     par(bg = "black", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 0.2), (max(layout[,
     1]) + 0.2)), ylim = c((min(layout[, 2]) -
     0.2), (max(layout[, 2]) + 0.2)))
     }
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     }
     }
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "black", text.col = "white")
     }
     }
     }
     }
     par(bg = "white")
    }
    <bytecode: 0x55ba7925ee08>
    <environment: namespace:GERGM>
     --- function search by body ---
    Function plot_network in namespace GERGM has this body.
     ----------- END OF FAILURE REPORT --------------
    Quitting from lines 96-102 (getting_started.Rmd)
    Error: processing vignette 'getting_started.Rmd' failed with diagnostics:
    the condition has length > 1
    --- failed re-building ‘getting_started.Rmd’
    
    SUMMARY: processing the following file failed:
     ‘getting_started.Rmd’
    
    Error: Vignette re-building failed.
    Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc

Version: 0.13.0
Check: installed package size
Result: NOTE
     installed size is 6.1Mb
     sub-directories of 1Mb or more:
     libs 4.9Mb
Flavors: r-devel-linux-x86_64-fedora-clang, r-release-osx-x86_64

Version: 0.13.0
Check: examples
Result: ERROR
    Running examples in ‘GERGM-Ex.R’ failed
    The error most likely occurred in:
    
    > ### Name: plot_network
    > ### Title: Plots of value-edged networks.
    > ### Aliases: plot_network
    >
    > ### ** Examples
    >
    > set.seed(12345)
    > sociomatrix <- matrix(rnorm(400,0,20),20,20)
    > colnames(sociomatrix) <- rownames(sociomatrix) <- letters[1:20]
    > plot_network(sociomatrix)
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
    :
     --- package (from environment) ---
    GERGM
     --- call from context ---
    plot_network(sociomatrix)
     --- call from argument ---
    if (class(sociomatrix) != "matrix" & class(sociomatrix) != "data.frame") {
     stop("You must provide the network as a numeric matrix.")
    }
     --- R stacktrace ---
    where 1: plot_network(sociomatrix)
    
     --- value of length: 2 type: logical ---
    [1] FALSE TRUE
     --- function from context ---
    function (sociomatrix, threshold = 0.5, save_pdf = FALSE, pdf_name = "Test.pdf",
     output_directory = "./", comparison_network = NULL, comparison_names = NULL,
     seed = NULL, white_background = FALSE, show_legend = TRUE,
     title = "", identical_node_positions = FALSE)
    {
     if (!is.null(seed)) {
     set.seed(seed)
     }
     par(mar = c(1, 0, 1, 0))
     if (class(sociomatrix) != "matrix" & class(sociomatrix) !=
     "data.frame") {
     stop("You must provide the network as a numeric matrix.")
     }
     if (nrow(sociomatrix) != ncol(sociomatrix)) {
     stop("You must provide a square matrix.")
     }
     if (white_background) {
     negcolors <- colorRampPalette(c("red", "white"))
     poscolors <- colorRampPalette(c("white", "blue"))
     negcolors <- negcolors(25)
     poscolors <- poscolors(25)
     }
     else {
     negcolors <- colorRampPalette(c("red", "black"))
     poscolors <- colorRampPalette(c("black", "blue"))
     negcolors <- negcolors(25)
     poscolors <- poscolors(25)
     }
     COMPARISON <- FALSE
     if (!is.null(comparison_network)) {
     if (is.null(comparison_names)) {
     comparison_names <- c("", "")
     }
     else {
     if (length(comparison_names) != 2) {
     stop("You must provide a comparison_names object as a vector containing two strings.")
     }
     }
     if (class(comparison_network) != "matrix" & class(comparison_network) !=
     "data.frame") {
     stop("You must provide the network as a numeric matrix.")
     }
     if (nrow(comparison_network) != ncol(comparison_network)) {
     stop("You must provide a square matrix.")
     }
     if (nrow(comparison_network) != nrow(sociomatrix)) {
     stop("You must provide two matrices with the same dimensions.")
     }
     COMPARISON <- TRUE
     diag(comparison_network) <- 0
     temp <- temp2 <- matrix(comparison_network[, ], nrow(comparison_network),
     ncol(comparison_network))
     cutoff <- max(abs(temp)) * threshold
     temp[which(abs(temp) < cutoff)] <- 0
     net3 <- igraph::graph.adjacency(temp, mode = "directed",
     weighted = TRUE, diag = FALSE)
     layout_c <- igraph::layout_with_fr(net3, weights = igraph::E(net3)$weight)
     net4 <- igraph::graph.adjacency(temp2, mode = "directed",
     weighted = TRUE, diag = FALSE)
     edgelist_c <- igraph::get.edgelist(net4)
     weights_c <- igraph::E(net4)$weight
     ordering <- order(abs(weights_c), decreasing = F)
     edgelist_c <- edgelist_c[ordering, ]
     weights_c <- weights_c[ordering]
     }
     diag(sociomatrix) <- 0
     temp <- temp2 <- matrix(sociomatrix[, ], nrow(sociomatrix),
     ncol(sociomatrix))
     cutoff <- max(abs(temp)) * threshold
     temp[which(abs(temp) < cutoff)] <- 0
     net <- igraph::graph.adjacency(temp, mode = "directed", weighted = TRUE,
     diag = FALSE)
     layout <- igraph::layout_with_fr(net, weights = igraph::E(net)$weight)
     net2 <- igraph::graph.adjacency(temp2, mode = "directed",
     weighted = TRUE, diag = FALSE)
     edgelist <- igraph::get.edgelist(net2)
     weights <- igraph::E(net2)$weight
     ordering <- order(abs(weights), decreasing = F)
     edgelist <- edgelist[ordering, ]
     weights <- weights[ordering]
     negbreaks <- seq(-max(abs(weights)), 0, length.out = 26)
     posbreaks <- seq(0, max(abs(weights)), length.out = 26)
     widbreaks <- seq(0, max(abs(weights)), length.out = 50)
     widths <- seq(0, 5, length.out = 50)
     if (COMPARISON) {
     negbreaks <- seq(-max(abs(c(weights, weights_c))), 0,
     length.out = 26)
     posbreaks <- seq(0, max(abs(c(weights, weights_c))),
     length.out = 26)
     widbreaks <- seq(0, max(abs(c(weights, weights_c))),
     length.out = 50)
     widths <- seq(0, 5, length.out = 50)
     }
     if (COMPARISON) {
     if (identical_node_positions) {
     layout_c <- layout
     }
     else {
     layout_c <- vegan::procrustes(layout, layout_c, scale = F)$Yrot
     }
     }
     if (save_pdf) {
     cur_directory <- getwd()
     setwd(output_directory)
     if (COMPARISON) {
     pdf(file = pdf_name, width = 24, height = 12)
     if (white_background) {
     par(bg = "white", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "black", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     else {
     par(bg = "black", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "white", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     max_bin <- 1
     min_bin <- 1
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin) {
     max_bin <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin) {
     min_bin <- bin
     }
     }
     }
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "white", text.col = "black", box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "black", text.col = "white")
     }
     }
     if (white_background) {
     plot(layout_c, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "black", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     else {
     plot(layout_c, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "white", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     max_bin_c <- 1
     min_bin_c <- 1
     for (i in 1:length(weights_c)) {
     cur1 <- layout_c[edgelist_c[i, 1], ]
     cur2 <- layout_c[edgelist_c[i, 2], ]
     curweight <- weights_c[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin_c) {
     max_bin_c <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin_c) {
     min_bin_c <- bin
     }
     }
     }
     if (white_background) {
     text(layout_c, labels = rownames(comparison_network),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout_c, labels = rownames(comparison_network),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "black", text.col = "white")
     }
     }
     dev.off()
     }
     else {
     pdf(file = pdf_name, width = 12, height = 12)
     if (white_background) {
     par(bg = "white", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 2), (max(layout[,
     1]) + 2)), ylim = c((min(layout[, 2]) - 2),
     (max(layout[, 2]) + 2)))
     }
     else {
     par(bg = "black", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 2), (max(layout[,
     1]) + 2)), ylim = c((min(layout[, 2]) - 2),
     (max(layout[, 2]) + 2)))
     }
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     }
     }
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "black", text.col = "white")
     }
     }
     dev.off()
     }
     setwd(cur_directory)
     }
     else {
     if (COMPARISON) {
     if (white_background) {
     par(bg = "white", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "black", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     else {
     par(bg = "black", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "white", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     max_bin <- 1
     min_bin <- 1
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin) {
     max_bin <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin) {
     min_bin <- bin
     }
     }
     }
     print(max_bin)
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "white", text.col = "black", box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "black", text.col = "white")
     }
     }
     if (white_background) {
     plot(layout_c, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "black", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     else {
     plot(layout_c, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "white", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     max_bin_c <- 1
     min_bin_c <- 1
     for (i in 1:length(weights_c)) {
     cur1 <- layout_c[edgelist_c[i, 1], ]
     cur2 <- layout_c[edgelist_c[i, 2], ]
     curweight <- weights_c[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin_c) {
     max_bin_c <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin_c) {
     min_bin_c <- bin
     }
     }
     }
     if (white_background) {
     text(layout_c, labels = rownames(comparison_network),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout_c, labels = rownames(comparison_network),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "black", text.col = "white")
     }
     }
     }
     else {
     if (white_background) {
     par(bg = "white", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 0.2), (max(layout[,
     1]) + 0.2)), ylim = c((min(layout[, 2]) -
     0.2), (max(layout[, 2]) + 0.2)))
     }
     else {
     par(bg = "black", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 0.2), (max(layout[,
     1]) + 0.2)), ylim = c((min(layout[, 2]) -
     0.2), (max(layout[, 2]) + 0.2)))
     }
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     }
     }
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "black", text.col = "white")
     }
     }
     }
     }
     par(bg = "white")
    }
    <bytecode: 0x2d3f460>
    <environment: namespace:GERGM>
     --- function search by body ---
    Function plot_network in namespace GERGM has this body.
     ----------- END OF FAILURE REPORT --------------
    Error in if (class(sociomatrix) != "matrix" & class(sociomatrix) != "data.frame") { :
     the condition has length > 1
    Calls: plot_network
    Execution halted
Flavor: r-devel-linux-x86_64-fedora-clang

Version: 0.13.0
Check: re-building of vignette outputs
Result: WARN
    Error(s) in re-building vignettes:
    --- re-building ‘getting_started.Rmd’ using rmarkdown
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
    :
     --- package (from environment) ---
    GERGM
     --- call from context ---
    plot_network(lending_2005)
     --- call from argument ---
    if (class(sociomatrix) != "matrix" & class(sociomatrix) != "data.frame") {
     stop("You must provide the network as a numeric matrix.")
    }
     --- R stacktrace ---
    where 1: plot_network(lending_2005)
    where 2: eval(expr, envir, enclos)
    where 3: eval(expr, envir, enclos)
    where 4: withVisible(eval(expr, envir, enclos))
    where 5: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler,
     error = eHandler, message = mHandler)
    where 6: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir,
     enclos)), warning = wHandler, error = eHandler, message = mHandler))
    where 7: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr,
     envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))
    where 8: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,
     debug = debug, last = i == length(out), use_try = stop_on_error !=
     2L, keep_warning = keep_warning, keep_message = keep_message,
     output_handler = output_handler, include_timing = include_timing)
    where 9: evaluate::evaluate(...)
    where 10: evaluate(code, envir = env, new_device = FALSE, keep_warning = !isFALSE(options$warning),
     keep_message = !isFALSE(options$message), stop_on_error = if (options$error &&
     options$include) 0L else 2L, output_handler = knit_handlers(options$render,
     options))
    where 11: in_dir(input_dir(), evaluate(code, envir = env, new_device = FALSE,
     keep_warning = !isFALSE(options$warning), keep_message = !isFALSE(options$message),
     stop_on_error = if (options$error && options$include) 0L else 2L,
     output_handler = knit_handlers(options$render, options)))
    where 12: block_exec(params)
    where 13: call_block(x)
    where 14: process_group.block(group)
    where 15: process_group(group)
    where 16: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),
     error = function(e) {
     setwd(wd)
     cat(res, sep = "\n", file = output %n% "")
     message("Quitting from lines ", paste(current_lines(i),
     collapse = "-"), " (", knit_concord$get("infile"),
     ") ")
     })
    where 17: process_file(text, output)
    where 18: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
    where 19: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(),
     output_dir = getwd(), ...)
    where 20: vweave_rmarkdown(...)
    where 21: engine$weave(file, quiet = quiet, encoding = enc)
    where 22: doTryCatch(return(expr), name, parentenv, handler)
    where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
    where 24: tryCatchList(expr, classes, parentenv, handlers)
    where 25: tryCatch({
     engine$weave(file, quiet = quiet, encoding = enc)
     setwd(startdir)
     output <- find_vignette_product(name, by = "weave", engine = engine)
     if (!have.makefile && vignette_is_tex(output)) {
     texi2pdf(file = output, clean = FALSE, quiet = quiet)
     output <- find_vignette_product(name, by = "texi2pdf",
     engine = engine)
     }
     outputs <- c(outputs, output)
    }, error = function(e) {
     thisOK <<- FALSE
     fails <<- c(fails, file)
     message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s",
     file, conditionMessage(e)))
    })
    where 26: tools:::buildVignettes(dir = "/data/gannet/ripley/R/packages/tests-clang/GERGM.Rcheck/vign_test/GERGM",
     ser_elibs = "/tmp/RtmpGswe8a/file414367521feb.rds")
    
     --- value of length: 2 type: logical ---
    [1] FALSE TRUE
     --- function from context ---
    function (sociomatrix, threshold = 0.5, save_pdf = FALSE, pdf_name = "Test.pdf",
     output_directory = "./", comparison_network = NULL, comparison_names = NULL,
     seed = NULL, white_background = FALSE, show_legend = TRUE,
     title = "", identical_node_positions = FALSE)
    {
     if (!is.null(seed)) {
     set.seed(seed)
     }
     par(mar = c(1, 0, 1, 0))
     if (class(sociomatrix) != "matrix" & class(sociomatrix) !=
     "data.frame") {
     stop("You must provide the network as a numeric matrix.")
     }
     if (nrow(sociomatrix) != ncol(sociomatrix)) {
     stop("You must provide a square matrix.")
     }
     if (white_background) {
     negcolors <- colorRampPalette(c("red", "white"))
     poscolors <- colorRampPalette(c("white", "blue"))
     negcolors <- negcolors(25)
     poscolors <- poscolors(25)
     }
     else {
     negcolors <- colorRampPalette(c("red", "black"))
     poscolors <- colorRampPalette(c("black", "blue"))
     negcolors <- negcolors(25)
     poscolors <- poscolors(25)
     }
     COMPARISON <- FALSE
     if (!is.null(comparison_network)) {
     if (is.null(comparison_names)) {
     comparison_names <- c("", "")
     }
     else {
     if (length(comparison_names) != 2) {
     stop("You must provide a comparison_names object as a vector containing two strings.")
     }
     }
     if (class(comparison_network) != "matrix" & class(comparison_network) !=
     "data.frame") {
     stop("You must provide the network as a numeric matrix.")
     }
     if (nrow(comparison_network) != ncol(comparison_network)) {
     stop("You must provide a square matrix.")
     }
     if (nrow(comparison_network) != nrow(sociomatrix)) {
     stop("You must provide two matrices with the same dimensions.")
     }
     COMPARISON <- TRUE
     diag(comparison_network) <- 0
     temp <- temp2 <- matrix(comparison_network[, ], nrow(comparison_network),
     ncol(comparison_network))
     cutoff <- max(abs(temp)) * threshold
     temp[which(abs(temp) < cutoff)] <- 0
     net3 <- igraph::graph.adjacency(temp, mode = "directed",
     weighted = TRUE, diag = FALSE)
     layout_c <- igraph::layout_with_fr(net3, weights = igraph::E(net3)$weight)
     net4 <- igraph::graph.adjacency(temp2, mode = "directed",
     weighted = TRUE, diag = FALSE)
     edgelist_c <- igraph::get.edgelist(net4)
     weights_c <- igraph::E(net4)$weight
     ordering <- order(abs(weights_c), decreasing = F)
     edgelist_c <- edgelist_c[ordering, ]
     weights_c <- weights_c[ordering]
     }
     diag(sociomatrix) <- 0
     temp <- temp2 <- matrix(sociomatrix[, ], nrow(sociomatrix),
     ncol(sociomatrix))
     cutoff <- max(abs(temp)) * threshold
     temp[which(abs(temp) < cutoff)] <- 0
     net <- igraph::graph.adjacency(temp, mode = "directed", weighted = TRUE,
     diag = FALSE)
     layout <- igraph::layout_with_fr(net, weights = igraph::E(net)$weight)
     net2 <- igraph::graph.adjacency(temp2, mode = "directed",
     weighted = TRUE, diag = FALSE)
     edgelist <- igraph::get.edgelist(net2)
     weights <- igraph::E(net2)$weight
     ordering <- order(abs(weights), decreasing = F)
     edgelist <- edgelist[ordering, ]
     weights <- weights[ordering]
     negbreaks <- seq(-max(abs(weights)), 0, length.out = 26)
     posbreaks <- seq(0, max(abs(weights)), length.out = 26)
     widbreaks <- seq(0, max(abs(weights)), length.out = 50)
     widths <- seq(0, 5, length.out = 50)
     if (COMPARISON) {
     negbreaks <- seq(-max(abs(c(weights, weights_c))), 0,
     length.out = 26)
     posbreaks <- seq(0, max(abs(c(weights, weights_c))),
     length.out = 26)
     widbreaks <- seq(0, max(abs(c(weights, weights_c))),
     length.out = 50)
     widths <- seq(0, 5, length.out = 50)
     }
     if (COMPARISON) {
     if (identical_node_positions) {
     layout_c <- layout
     }
     else {
     layout_c <- vegan::procrustes(layout, layout_c, scale = F)$Yrot
     }
     }
     if (save_pdf) {
     cur_directory <- getwd()
     setwd(output_directory)
     if (COMPARISON) {
     pdf(file = pdf_name, width = 24, height = 12)
     if (white_background) {
     par(bg = "white", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "black", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     else {
     par(bg = "black", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "white", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     max_bin <- 1
     min_bin <- 1
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin) {
     max_bin <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin) {
     min_bin <- bin
     }
     }
     }
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "white", text.col = "black", box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "black", text.col = "white")
     }
     }
     if (white_background) {
     plot(layout_c, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "black", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     else {
     plot(layout_c, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "white", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     max_bin_c <- 1
     min_bin_c <- 1
     for (i in 1:length(weights_c)) {
     cur1 <- layout_c[edgelist_c[i, 1], ]
     cur2 <- layout_c[edgelist_c[i, 2], ]
     curweight <- weights_c[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin_c) {
     max_bin_c <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin_c) {
     min_bin_c <- bin
     }
     }
     }
     if (white_background) {
     text(layout_c, labels = rownames(comparison_network),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout_c, labels = rownames(comparison_network),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "black", text.col = "white")
     }
     }
     dev.off()
     }
     else {
     pdf(file = pdf_name, width = 12, height = 12)
     if (white_background) {
     par(bg = "white", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 2), (max(layout[,
     1]) + 2)), ylim = c((min(layout[, 2]) - 2),
     (max(layout[, 2]) + 2)))
     }
     else {
     par(bg = "black", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 2), (max(layout[,
     1]) + 2)), ylim = c((min(layout[, 2]) - 2),
     (max(layout[, 2]) + 2)))
     }
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     }
     }
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "black", text.col = "white")
     }
     }
     dev.off()
     }
     setwd(cur_directory)
     }
     else {
     if (COMPARISON) {
     if (white_background) {
     par(bg = "white", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "black", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     else {
     par(bg = "black", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "white", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     max_bin <- 1
     min_bin <- 1
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin) {
     max_bin <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin) {
     min_bin <- bin
     }
     }
     }
     print(max_bin)
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "white", text.col = "black", box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "black", text.col = "white")
     }
     }
     if (white_background) {
     plot(layout_c, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "black", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     else {
     plot(layout_c, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "white", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     max_bin_c <- 1
     min_bin_c <- 1
     for (i in 1:length(weights_c)) {
     cur1 <- layout_c[edgelist_c[i, 1], ]
     cur2 <- layout_c[edgelist_c[i, 2], ]
     curweight <- weights_c[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin_c) {
     max_bin_c <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin_c) {
     min_bin_c <- bin
     }
     }
     }
     if (white_background) {
     text(layout_c, labels = rownames(comparison_network),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout_c, labels = rownames(comparison_network),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "black", text.col = "white")
     }
     }
     }
     else {
     if (white_background) {
     par(bg = "white", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 0.2), (max(layout[,
     1]) + 0.2)), ylim = c((min(layout[, 2]) -
     0.2), (max(layout[, 2]) + 0.2)))
     }
     else {
     par(bg = "black", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 0.2), (max(layout[,
     1]) + 0.2)), ylim = c((min(layout[, 2]) -
     0.2), (max(layout[, 2]) + 0.2)))
     }
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     }
     }
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "black", text.col = "white")
     }
     }
     }
     }
     par(bg = "white")
    }
    <bytecode: 0x4679d30>
    <environment: namespace:GERGM>
     --- function search by body ---
    Function plot_network in namespace GERGM has this body.
     ----------- END OF FAILURE REPORT --------------
    Quitting from lines 96-102 (getting_started.Rmd)
    Error: processing vignette 'getting_started.Rmd' failed with diagnostics:
    the condition has length > 1
    --- failed re-building ‘getting_started.Rmd’
    
    SUMMARY: processing the following file failed:
     ‘getting_started.Rmd’
    
    Error: Vignette re-building failed.
    Execution halted
Flavor: r-devel-linux-x86_64-fedora-clang

Version: 0.13.0
Check: examples
Result: ERROR
    Running examples in ‘GERGM-Ex.R’ failed
    The error most likely occurred in:
    
    > ### Name: plot_network
    > ### Title: Plots of value-edged networks.
    > ### Aliases: plot_network
    >
    > ### ** Examples
    >
    > set.seed(12345)
    > sociomatrix <- matrix(rnorm(400,0,20),20,20)
    > colnames(sociomatrix) <- rownames(sociomatrix) <- letters[1:20]
    > plot_network(sociomatrix)
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
    :
     --- package (from environment) ---
    GERGM
     --- call from context ---
    plot_network(sociomatrix)
     --- call from argument ---
    if (class(sociomatrix) != "matrix" & class(sociomatrix) != "data.frame") {
     stop("You must provide the network as a numeric matrix.")
    }
     --- R stacktrace ---
    where 1: plot_network(sociomatrix)
    
     --- value of length: 2 type: logical ---
    [1] FALSE TRUE
     --- function from context ---
    function (sociomatrix, threshold = 0.5, save_pdf = FALSE, pdf_name = "Test.pdf",
     output_directory = "./", comparison_network = NULL, comparison_names = NULL,
     seed = NULL, white_background = FALSE, show_legend = TRUE,
     title = "", identical_node_positions = FALSE)
    {
     if (!is.null(seed)) {
     set.seed(seed)
     }
     par(mar = c(1, 0, 1, 0))
     if (class(sociomatrix) != "matrix" & class(sociomatrix) !=
     "data.frame") {
     stop("You must provide the network as a numeric matrix.")
     }
     if (nrow(sociomatrix) != ncol(sociomatrix)) {
     stop("You must provide a square matrix.")
     }
     if (white_background) {
     negcolors <- colorRampPalette(c("red", "white"))
     poscolors <- colorRampPalette(c("white", "blue"))
     negcolors <- negcolors(25)
     poscolors <- poscolors(25)
     }
     else {
     negcolors <- colorRampPalette(c("red", "black"))
     poscolors <- colorRampPalette(c("black", "blue"))
     negcolors <- negcolors(25)
     poscolors <- poscolors(25)
     }
     COMPARISON <- FALSE
     if (!is.null(comparison_network)) {
     if (is.null(comparison_names)) {
     comparison_names <- c("", "")
     }
     else {
     if (length(comparison_names) != 2) {
     stop("You must provide a comparison_names object as a vector containing two strings.")
     }
     }
     if (class(comparison_network) != "matrix" & class(comparison_network) !=
     "data.frame") {
     stop("You must provide the network as a numeric matrix.")
     }
     if (nrow(comparison_network) != ncol(comparison_network)) {
     stop("You must provide a square matrix.")
     }
     if (nrow(comparison_network) != nrow(sociomatrix)) {
     stop("You must provide two matrices with the same dimensions.")
     }
     COMPARISON <- TRUE
     diag(comparison_network) <- 0
     temp <- temp2 <- matrix(comparison_network[, ], nrow(comparison_network),
     ncol(comparison_network))
     cutoff <- max(abs(temp)) * threshold
     temp[which(abs(temp) < cutoff)] <- 0
     net3 <- igraph::graph.adjacency(temp, mode = "directed",
     weighted = TRUE, diag = FALSE)
     layout_c <- igraph::layout_with_fr(net3, weights = igraph::E(net3)$weight)
     net4 <- igraph::graph.adjacency(temp2, mode = "directed",
     weighted = TRUE, diag = FALSE)
     edgelist_c <- igraph::get.edgelist(net4)
     weights_c <- igraph::E(net4)$weight
     ordering <- order(abs(weights_c), decreasing = F)
     edgelist_c <- edgelist_c[ordering, ]
     weights_c <- weights_c[ordering]
     }
     diag(sociomatrix) <- 0
     temp <- temp2 <- matrix(sociomatrix[, ], nrow(sociomatrix),
     ncol(sociomatrix))
     cutoff <- max(abs(temp)) * threshold
     temp[which(abs(temp) < cutoff)] <- 0
     net <- igraph::graph.adjacency(temp, mode = "directed", weighted = TRUE,
     diag = FALSE)
     layout <- igraph::layout_with_fr(net, weights = igraph::E(net)$weight)
     net2 <- igraph::graph.adjacency(temp2, mode = "directed",
     weighted = TRUE, diag = FALSE)
     edgelist <- igraph::get.edgelist(net2)
     weights <- igraph::E(net2)$weight
     ordering <- order(abs(weights), decreasing = F)
     edgelist <- edgelist[ordering, ]
     weights <- weights[ordering]
     negbreaks <- seq(-max(abs(weights)), 0, length.out = 26)
     posbreaks <- seq(0, max(abs(weights)), length.out = 26)
     widbreaks <- seq(0, max(abs(weights)), length.out = 50)
     widths <- seq(0, 5, length.out = 50)
     if (COMPARISON) {
     negbreaks <- seq(-max(abs(c(weights, weights_c))), 0,
     length.out = 26)
     posbreaks <- seq(0, max(abs(c(weights, weights_c))),
     length.out = 26)
     widbreaks <- seq(0, max(abs(c(weights, weights_c))),
     length.out = 50)
     widths <- seq(0, 5, length.out = 50)
     }
     if (COMPARISON) {
     if (identical_node_positions) {
     layout_c <- layout
     }
     else {
     layout_c <- vegan::procrustes(layout, layout_c, scale = F)$Yrot
     }
     }
     if (save_pdf) {
     cur_directory <- getwd()
     setwd(output_directory)
     if (COMPARISON) {
     pdf(file = pdf_name, width = 24, height = 12)
     if (white_background) {
     par(bg = "white", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "black", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     else {
     par(bg = "black", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "white", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     max_bin <- 1
     min_bin <- 1
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin) {
     max_bin <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin) {
     min_bin <- bin
     }
     }
     }
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "white", text.col = "black", box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "black", text.col = "white")
     }
     }
     if (white_background) {
     plot(layout_c, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "black", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     else {
     plot(layout_c, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "white", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     max_bin_c <- 1
     min_bin_c <- 1
     for (i in 1:length(weights_c)) {
     cur1 <- layout_c[edgelist_c[i, 1], ]
     cur2 <- layout_c[edgelist_c[i, 2], ]
     curweight <- weights_c[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin_c) {
     max_bin_c <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin_c) {
     min_bin_c <- bin
     }
     }
     }
     if (white_background) {
     text(layout_c, labels = rownames(comparison_network),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout_c, labels = rownames(comparison_network),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "black", text.col = "white")
     }
     }
     dev.off()
     }
     else {
     pdf(file = pdf_name, width = 12, height = 12)
     if (white_background) {
     par(bg = "white", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 2), (max(layout[,
     1]) + 2)), ylim = c((min(layout[, 2]) - 2),
     (max(layout[, 2]) + 2)))
     }
     else {
     par(bg = "black", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 2), (max(layout[,
     1]) + 2)), ylim = c((min(layout[, 2]) - 2),
     (max(layout[, 2]) + 2)))
     }
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     }
     }
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "black", text.col = "white")
     }
     }
     dev.off()
     }
     setwd(cur_directory)
     }
     else {
     if (COMPARISON) {
     if (white_background) {
     par(bg = "white", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "black", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     else {
     par(bg = "black", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "white", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     max_bin <- 1
     min_bin <- 1
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin) {
     max_bin <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin) {
     min_bin <- bin
     }
     }
     }
     print(max_bin)
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "white", text.col = "black", box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "black", text.col = "white")
     }
     }
     if (white_background) {
     plot(layout_c, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "black", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     else {
     plot(layout_c, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "white", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     max_bin_c <- 1
     min_bin_c <- 1
     for (i in 1:length(weights_c)) {
     cur1 <- layout_c[edgelist_c[i, 1], ]
     cur2 <- layout_c[edgelist_c[i, 2], ]
     curweight <- weights_c[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin_c) {
     max_bin_c <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin_c) {
     min_bin_c <- bin
     }
     }
     }
     if (white_background) {
     text(layout_c, labels = rownames(comparison_network),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout_c, labels = rownames(comparison_network),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "black", text.col = "white")
     }
     }
     }
     else {
     if (white_background) {
     par(bg = "white", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 0.2), (max(layout[,
     1]) + 0.2)), ylim = c((min(layout[, 2]) -
     0.2), (max(layout[, 2]) + 0.2)))
     }
     else {
     par(bg = "black", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 0.2), (max(layout[,
     1]) + 0.2)), ylim = c((min(layout[, 2]) -
     0.2), (max(layout[, 2]) + 0.2)))
     }
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     }
     }
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "black", text.col = "white")
     }
     }
     }
     }
     par(bg = "white")
    }
    <bytecode: 0x2c9ee28>
    <environment: namespace:GERGM>
     --- function search by body ---
    Function plot_network in namespace GERGM has this body.
     ----------- END OF FAILURE REPORT --------------
    Error in if (class(sociomatrix) != "matrix" & class(sociomatrix) != "data.frame") { :
     the condition has length > 1
    Calls: plot_network
    Execution halted
Flavor: r-devel-linux-x86_64-fedora-gcc

Version: 0.13.0
Check: re-building of vignette outputs
Result: WARN
    Error(s) in re-building vignettes:
    --- re-building ‘getting_started.Rmd’ using rmarkdown
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
    :
     --- package (from environment) ---
    GERGM
     --- call from context ---
    plot_network(lending_2005)
     --- call from argument ---
    if (class(sociomatrix) != "matrix" & class(sociomatrix) != "data.frame") {
     stop("You must provide the network as a numeric matrix.")
    }
     --- R stacktrace ---
    where 1: plot_network(lending_2005)
    where 2: eval(expr, envir, enclos)
    where 3: eval(expr, envir, enclos)
    where 4: withVisible(eval(expr, envir, enclos))
    where 5: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler,
     error = eHandler, message = mHandler)
    where 6: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir,
     enclos)), warning = wHandler, error = eHandler, message = mHandler))
    where 7: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr,
     envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))
    where 8: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,
     debug = debug, last = i == length(out), use_try = stop_on_error !=
     2L, keep_warning = keep_warning, keep_message = keep_message,
     output_handler = output_handler, include_timing = include_timing)
    where 9: evaluate::evaluate(...)
    where 10: evaluate(code, envir = env, new_device = FALSE, keep_warning = !isFALSE(options$warning),
     keep_message = !isFALSE(options$message), stop_on_error = if (options$error &&
     options$include) 0L else 2L, output_handler = knit_handlers(options$render,
     options))
    where 11: in_dir(input_dir(), evaluate(code, envir = env, new_device = FALSE,
     keep_warning = !isFALSE(options$warning), keep_message = !isFALSE(options$message),
     stop_on_error = if (options$error && options$include) 0L else 2L,
     output_handler = knit_handlers(options$render, options)))
    where 12: block_exec(params)
    where 13: call_block(x)
    where 14: process_group.block(group)
    where 15: process_group(group)
    where 16: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),
     error = function(e) {
     setwd(wd)
     cat(res, sep = "\n", file = output %n% "")
     message("Quitting from lines ", paste(current_lines(i),
     collapse = "-"), " (", knit_concord$get("infile"),
     ") ")
     })
    where 17: process_file(text, output)
    where 18: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
    where 19: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(),
     output_dir = getwd(), ...)
    where 20: vweave_rmarkdown(...)
    where 21: engine$weave(file, quiet = quiet, encoding = enc)
    where 22: doTryCatch(return(expr), name, parentenv, handler)
    where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
    where 24: tryCatchList(expr, classes, parentenv, handlers)
    where 25: tryCatch({
     engine$weave(file, quiet = quiet, encoding = enc)
     setwd(startdir)
     output <- find_vignette_product(name, by = "weave", engine = engine)
     if (!have.makefile && vignette_is_tex(output)) {
     texi2pdf(file = output, clean = FALSE, quiet = quiet)
     output <- find_vignette_product(name, by = "texi2pdf",
     engine = engine)
     }
     outputs <- c(outputs, output)
    }, error = function(e) {
     thisOK <<- FALSE
     fails <<- c(fails, file)
     message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s",
     file, conditionMessage(e)))
    })
    where 26: tools:::buildVignettes(dir = "/data/gannet/ripley/R/packages/tests-devel/GERGM.Rcheck/vign_test/GERGM",
     ser_elibs = "/tmp/Rtmpu2Oa1d/file2f1c46a23894.rds")
    
     --- value of length: 2 type: logical ---
    [1] FALSE TRUE
     --- function from context ---
    function (sociomatrix, threshold = 0.5, save_pdf = FALSE, pdf_name = "Test.pdf",
     output_directory = "./", comparison_network = NULL, comparison_names = NULL,
     seed = NULL, white_background = FALSE, show_legend = TRUE,
     title = "", identical_node_positions = FALSE)
    {
     if (!is.null(seed)) {
     set.seed(seed)
     }
     par(mar = c(1, 0, 1, 0))
     if (class(sociomatrix) != "matrix" & class(sociomatrix) !=
     "data.frame") {
     stop("You must provide the network as a numeric matrix.")
     }
     if (nrow(sociomatrix) != ncol(sociomatrix)) {
     stop("You must provide a square matrix.")
     }
     if (white_background) {
     negcolors <- colorRampPalette(c("red", "white"))
     poscolors <- colorRampPalette(c("white", "blue"))
     negcolors <- negcolors(25)
     poscolors <- poscolors(25)
     }
     else {
     negcolors <- colorRampPalette(c("red", "black"))
     poscolors <- colorRampPalette(c("black", "blue"))
     negcolors <- negcolors(25)
     poscolors <- poscolors(25)
     }
     COMPARISON <- FALSE
     if (!is.null(comparison_network)) {
     if (is.null(comparison_names)) {
     comparison_names <- c("", "")
     }
     else {
     if (length(comparison_names) != 2) {
     stop("You must provide a comparison_names object as a vector containing two strings.")
     }
     }
     if (class(comparison_network) != "matrix" & class(comparison_network) !=
     "data.frame") {
     stop("You must provide the network as a numeric matrix.")
     }
     if (nrow(comparison_network) != ncol(comparison_network)) {
     stop("You must provide a square matrix.")
     }
     if (nrow(comparison_network) != nrow(sociomatrix)) {
     stop("You must provide two matrices with the same dimensions.")
     }
     COMPARISON <- TRUE
     diag(comparison_network) <- 0
     temp <- temp2 <- matrix(comparison_network[, ], nrow(comparison_network),
     ncol(comparison_network))
     cutoff <- max(abs(temp)) * threshold
     temp[which(abs(temp) < cutoff)] <- 0
     net3 <- igraph::graph.adjacency(temp, mode = "directed",
     weighted = TRUE, diag = FALSE)
     layout_c <- igraph::layout_with_fr(net3, weights = igraph::E(net3)$weight)
     net4 <- igraph::graph.adjacency(temp2, mode = "directed",
     weighted = TRUE, diag = FALSE)
     edgelist_c <- igraph::get.edgelist(net4)
     weights_c <- igraph::E(net4)$weight
     ordering <- order(abs(weights_c), decreasing = F)
     edgelist_c <- edgelist_c[ordering, ]
     weights_c <- weights_c[ordering]
     }
     diag(sociomatrix) <- 0
     temp <- temp2 <- matrix(sociomatrix[, ], nrow(sociomatrix),
     ncol(sociomatrix))
     cutoff <- max(abs(temp)) * threshold
     temp[which(abs(temp) < cutoff)] <- 0
     net <- igraph::graph.adjacency(temp, mode = "directed", weighted = TRUE,
     diag = FALSE)
     layout <- igraph::layout_with_fr(net, weights = igraph::E(net)$weight)
     net2 <- igraph::graph.adjacency(temp2, mode = "directed",
     weighted = TRUE, diag = FALSE)
     edgelist <- igraph::get.edgelist(net2)
     weights <- igraph::E(net2)$weight
     ordering <- order(abs(weights), decreasing = F)
     edgelist <- edgelist[ordering, ]
     weights <- weights[ordering]
     negbreaks <- seq(-max(abs(weights)), 0, length.out = 26)
     posbreaks <- seq(0, max(abs(weights)), length.out = 26)
     widbreaks <- seq(0, max(abs(weights)), length.out = 50)
     widths <- seq(0, 5, length.out = 50)
     if (COMPARISON) {
     negbreaks <- seq(-max(abs(c(weights, weights_c))), 0,
     length.out = 26)
     posbreaks <- seq(0, max(abs(c(weights, weights_c))),
     length.out = 26)
     widbreaks <- seq(0, max(abs(c(weights, weights_c))),
     length.out = 50)
     widths <- seq(0, 5, length.out = 50)
     }
     if (COMPARISON) {
     if (identical_node_positions) {
     layout_c <- layout
     }
     else {
     layout_c <- vegan::procrustes(layout, layout_c, scale = F)$Yrot
     }
     }
     if (save_pdf) {
     cur_directory <- getwd()
     setwd(output_directory)
     if (COMPARISON) {
     pdf(file = pdf_name, width = 24, height = 12)
     if (white_background) {
     par(bg = "white", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "black", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     else {
     par(bg = "black", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "white", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     max_bin <- 1
     min_bin <- 1
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin) {
     max_bin <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin) {
     min_bin <- bin
     }
     }
     }
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "white", text.col = "black", box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "black", text.col = "white")
     }
     }
     if (white_background) {
     plot(layout_c, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "black", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     else {
     plot(layout_c, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "white", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     max_bin_c <- 1
     min_bin_c <- 1
     for (i in 1:length(weights_c)) {
     cur1 <- layout_c[edgelist_c[i, 1], ]
     cur2 <- layout_c[edgelist_c[i, 2], ]
     curweight <- weights_c[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin_c) {
     max_bin_c <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin_c) {
     min_bin_c <- bin
     }
     }
     }
     if (white_background) {
     text(layout_c, labels = rownames(comparison_network),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout_c, labels = rownames(comparison_network),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "black", text.col = "white")
     }
     }
     dev.off()
     }
     else {
     pdf(file = pdf_name, width = 12, height = 12)
     if (white_background) {
     par(bg = "white", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 2), (max(layout[,
     1]) + 2)), ylim = c((min(layout[, 2]) - 2),
     (max(layout[, 2]) + 2)))
     }
     else {
     par(bg = "black", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 2), (max(layout[,
     1]) + 2)), ylim = c((min(layout[, 2]) - 2),
     (max(layout[, 2]) + 2)))
     }
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     }
     }
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "black", text.col = "white")
     }
     }
     dev.off()
     }
     setwd(cur_directory)
     }
     else {
     if (COMPARISON) {
     if (white_background) {
     par(bg = "white", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "black", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     else {
     par(bg = "black", oma = c(1, 1, 2, 1) + 0.1,
     mar = c(0, 0.5, 1, 0.5) + 0.5, xpd = TRUE,
     mfrow = c(1, 2))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[1],
     col.main = "white", xlim = c((min(layout[,
     1]) - 0.1), (max(layout[, 1]) + 0.1)), ylim = c((min(layout[,
     2]) - 1.3), (max(layout[, 2]) + 0.5)))
     }
     max_bin <- 1
     min_bin <- 1
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin) {
     max_bin <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin) {
     min_bin <- bin
     }
     }
     }
     print(max_bin)
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "white", text.col = "black", box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c(negcolors[min_bin -
     1], poscolors[max_bin - 1]), horiz = T,
     bg = "black", text.col = "white")
     }
     }
     if (white_background) {
     plot(layout_c, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "black", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     else {
     plot(layout_c, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = comparison_names[2],
     col.main = "white", xlim = c((min(layout_c[,
     1]) - 0.1), (max(layout_c[, 1]) + 0.1)),
     ylim = c((min(layout_c[, 2]) - 1.3), (max(layout_c[,
     2]) + 0.5)))
     }
     max_bin_c <- 1
     min_bin_c <- 1
     for (i in 1:length(weights_c)) {
     cur1 <- layout_c[edgelist_c[i, 1], ]
     cur2 <- layout_c[edgelist_c[i, 2], ]
     curweight <- weights_c[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     if (bin > max_bin_c) {
     max_bin_c <- bin
     }
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     if (bin > min_bin_c) {
     min_bin_c <- bin
     }
     }
     }
     if (white_background) {
     text(layout_c, labels = rownames(comparison_network),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout_c, labels = rownames(comparison_network),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(comparison_network),
     2), round(max(comparison_network), 2)),
     fill = c(negcolors[min_bin_c - 1], poscolors[max_bin_c -
     1]), horiz = T, bg = "black", text.col = "white")
     }
     }
     }
     else {
     if (white_background) {
     par(bg = "white", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "white",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 0.2), (max(layout[,
     1]) + 0.2)), ylim = c((min(layout[, 2]) -
     0.2), (max(layout[, 2]) + 0.2)))
     }
     else {
     par(bg = "black", oma = c(0.1, 0.1, 0.1, 0.1) +
     0.1, mar = c(0, 0, 0, 0), xpd = TRUE, mfrow = c(1,
     1))
     plot(layout, pch = 20, cex = 1, col = "black",
     axes = F, xlab = "", ylab = "", main = title,
     xlim = c((min(layout[, 1]) - 0.2), (max(layout[,
     1]) + 0.2)), ylim = c((min(layout[, 2]) -
     0.2), (max(layout[, 2]) + 0.2)))
     }
     for (i in 1:length(weights)) {
     cur1 <- layout[edgelist[i, 1], ]
     cur2 <- layout[edgelist[i, 2], ]
     curweight <- weights[i]
     nf <- TRUE
     counter <- 1
     bin <- 1
     while (nf) {
     if (curweight > 0) {
     if (posbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     else {
     if (negbreaks[counter] >= curweight) {
     bin <- counter
     nf <- FALSE
     }
     }
     counter <- counter + 1
     }
     nf <- TRUE
     counter <- 1
     wid <- 1
     while (nf) {
     if (widbreaks[counter] >= abs(curweight)) {
     wid <- counter
     nf <- FALSE
     }
     counter <- counter + 1
     }
     if (curweight > 0) {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = poscolors[bin], lwd = widths[wid])
     }
     else {
     lines(c(cur1[1], cur2[1]), c(cur1[2], cur2[2]),
     col = negcolors[bin], lwd = widths[wid])
     }
     }
     if (white_background) {
     text(layout, labels = rownames(sociomatrix),
     col = "black")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "black", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "white", text.col = "black",
     box.col = "white")
     }
     }
     else {
     text(layout, labels = rownames(sociomatrix),
     col = "white")
     if (show_legend) {
     legend("bottom", inset = 0, title = "Edge Values",
     title.col = "white", legend = c(round(min(sociomatrix),
     2), round(max(sociomatrix), 2)), fill = c("red",
     "blue"), horiz = T, bg = "black", text.col = "white")
     }
     }
     }
     }
     par(bg = "white")
    }
    <bytecode: 0x43e1168>
    <environment: namespace:GERGM>
     --- function search by body ---
    Function plot_network in namespace GERGM has this body.
     ----------- END OF FAILURE REPORT --------------
    Quitting from lines 96-102 (getting_started.Rmd)
    Error: processing vignette 'getting_started.Rmd' failed with diagnostics:
    the condition has length > 1
    --- failed re-building ‘getting_started.Rmd’
    
    SUMMARY: processing the following file failed:
     ‘getting_started.Rmd’
    
    Error: Vignette re-building failed.
    Execution halted
Flavor: r-devel-linux-x86_64-fedora-gcc