R Under development (unstable) (2025-05-04 r88189 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # tests for formation and dissolution functions > require(tsna) Loading required package: tsna Loading required package: network 'network' 1.19.0 (2024-12-08), part of the Statnet Project * 'news(package="network")' for changes since last version * 'citation("network")' for citation information * 'https://statnet.org' for help, support, and other information Loading required package: networkDynamic 'networkDynamic' 0.11.5 (2024-11-21), part of the Statnet Project * 'news(package="networkDynamic")' for changes since last version * 'citation("networkDynamic")' for citation information * 'https://statnet.org' for help, support, and other information > require(testthat) Loading required package: testthat > require(networkDynamicData) Loading required package: networkDynamicData > > # ------ tEdgeDissolution ------- > test<-network.initialize(4,directed = TRUE,loops = FALSE) > add.edges.active(test,1,2,onset = 0,terminus=3) > # check for ts class > expect_true(is.ts(tEdgeDissolution(test,start=0,end=3))) > # correct count > expect_equal(as.numeric(tEdgeDissolution(test,start=0,end=3)),c(0,0,0,1)) > expect_equal(as.numeric(tEdgeDissolution(test,start=0,end=3,time.interval=0.5)),c(0,0,0,0,0,0, 1)) > > # check with fractions > add.edges.active(test,2,1,onset = 0,terminus=2) > expect_equal(as.numeric(tEdgeDissolution(test,result.type = 'fraction')),c(0,0,0.5,1)) > > > expect_warning(tEdgeDissolution(network.initialize(0)),regexp = 'network does not appear to have any time range information') > > > > > > # -------- tEdgeFormation --------- > test<-network.initialize(4,directed = TRUE,loops = FALSE) > add.edges.active(test,1,2,onset = 0,terminus=3) > add.edges.active(test,2,3,onset = 1,terminus=3) > > # test class > expect_true(is.ts(tEdgeFormation(test))) > > # test count > expect_equal(as.numeric(tEdgeFormation(test)),c(1,1,0,0)) > > # test fraction > expect_equal(as.numeric(tEdgeFormation(test,result.type = 'fraction')),c(1/12, 1/11,0,0)) > > > # test various network types > test%n%'directed'<-FALSE > expect_equal(as.numeric(tEdgeFormation(test,result.type = 'fraction')),c(1/6, 1/5,0,0)) > > test%n%'loops'<-TRUE > expect_equal(as.numeric(tEdgeFormation(test,result.type = 'fraction')),c(1/10, 1/9,0,0)) > > test%n%'directed'<-TRUE > expect_equal(as.numeric(tEdgeFormation(test,result.type = 'fraction')),c(1/16, 1/15,0,0)) > > # check bipartite > test<-network.initialize(5,directed = TRUE,loops = FALSE,bipartite=2) > add.edges.active(test,1,3,onset=0,terminus=2) > expect_equal(as.numeric(tEdgeFormation(test,result.type='fraction')),c(1/6,0,0)) > > # check multiplex > expect_error(tEdgeFormation(network.initialize(0,multiple = TRUE),result.type='fraction'),regexp = 'can not compute possible number of free dyads for multiplex networks') Warning message: In tEdgeFormation(network.initialize(0, multiple = TRUE), result.type = "fraction") : network does not appear to have any time range information and start and end parameters not provided. Using start=0 end=0 > # > > # check censoring toggle > data(concurrencyComparisonNets) > expect_equal(as.numeric(tEdgeFormation(base,start=1,end=4,include.censored = FALSE)),c(0,0,24,18)) > expect_equal(as.numeric(tEdgeFormation(base,start=1,end=4,include.censored = TRUE)),c(0,371,24,18)) > > expect_equal(as.numeric(tEdgeDissolution(base,start=100,end=103,include.censored = TRUE)),c(23,20,364,0)) > expect_equal(as.numeric(tEdgeDissolution(base,start=100,end=103,include.censored = FALSE)),c(23,20,18,0)) > > proc.time() user system elapsed 2.68 0.32 3.00