Open kyleam opened 2 years ago
Thanks for your work on this package.
When I try to build with R 4.1 from GERGM's master (ffb67f7), I see a failure related to a non-scalar condition:
* checking examples ... 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 ---
If I resolve that and a related issue with the following patch...
diff --git a/R/plot_network.R b/R/plot_network.R index 0569e38..63f7fad 100644 --- a/R/plot_network.R +++ b/R/plot_network.R @@ -55,7 +55,7 @@ plot_network <- function(sociomatrix, par(mar = c(1,0,1,0)) # check input - if (class(sociomatrix) != "matrix" & class(sociomatrix) != "data.frame") { + if (!inherits(sociomatrix, c("matrix", "data.frame"))) { stop("You must provide the network as a numeric matrix.") } @@ -90,8 +90,7 @@ plot_network <- function(sociomatrix, } # check optional input - if (class(comparison_network) != "matrix" & - class(comparison_network) != "data.frame") { + if (!inherits(comparison_network, c("matrix", "data.frame"))) { stop("You must provide the network as a numeric matrix.") }
... I hit into another error in the same example:
❯ checking examples ... 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) Error in igraph::layout_with_fr(net, weights = igraph::E(net)$weight) : At core/layout/fruchterman_reingold.c:401 : Weights must be positive for Fruchterman-Reingold layout. Invalid value Calls: plot_network -> <Anonymous> Execution halted
That failure is with igraph 1.3.4, which was published 2022-07-19. If I try with 1.3.3, I see the same failure. The failure goes away with 1.3.2.
Perhaps igraph got stricter in its checks and the example just needs to be updated to use more realistic input?
Thanks for your work on this package.
When I try to build with R 4.1 from GERGM's master (ffb67f7), I see a failure related to a non-scalar condition:
If I resolve that and a related issue with the following patch...
... I hit into another error in the same example:
That failure is with igraph 1.3.4, which was published 2022-07-19. If I try with 1.3.3, I see the same failure. The failure goes away with 1.3.2.
Perhaps igraph got stricter in its checks and the example just needs to be updated to use more realistic input?