Matrix-related test fails
mbojan opened this issue · comments
Michał Bojanowski commented
R CMD check yells:
> expect_equal(as.matrix.network.edgelist(test),structure(c(5L, 1L, 1L, 5L), .Dim = c(2L, 2L), n = 5, vnames = 1:5))
> # sort order should be different
> if(Sys.getenv("_R_CLASS_MATRIX_ARRAY_")==""){
+ expect_equal(as.edgelist(test),structure(c(1L, 5L, 5L, 1L), .Dim = c(2L, 2L), n = 5, vnames = 1:5, directed = TRUE, bipartite = FALSE, loops = FALSE, class = c("matrix_edgelist", "edgelist","matrix")))
+ }else{
+ expect_equal(as.edgelist(test),structure(c(1L, 5L, 5L, 1L), .Dim = c(2L, 2L), n = 5, vnames = 1:5, directed = TRUE, bipartite = FALSE, loops = FALSE, class = c("matrix_edgelist", "edgelist","matrix","array")))
+ }
Error: as.edgelist(test) not equal to structure(...).
Attributes: < Component "class": Lengths (4, 3) differ (string compare on first 3) >
I am looking into this right now.
Michał Bojanowski commented
This is because in R 4.0.0 matrix class extends array class by default and the environment variable _R_CLASS_MATRIX_ARRAY_
is not used anymore.
I think I will add a R.version
test into the if()
so that the test can still make sense on R < 4.0.0.
Michał Bojanowski commented
Done by the merge