R Under development (unstable) (2024-07-01 r86857 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 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. > # some tests tfor the proximity.timeline function > require(ndtv) Loading required package: ndtv Loading required package: network 'network' 1.18.2 (2023-12-04), 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.4 (2023-12-10?), 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 Loading required package: animation Loading required package: sna Loading required package: statnet.common Attaching package: 'statnet.common' The following objects are masked from 'package:base': attr, order sna: Tools for Social Network Analysis Version 2.7-2 created on 2023-12-05. copyright (c) 2005, Carter T. Butts, University of California-Irvine For citation information, type citation("sna"). Type help(package="sna") to get started. 'ndtv' 0.13.4 (2023-06-30), part of the Statnet Project * 'news(package="ndtv")' for changes since last version * 'citation("ndtv")' for citation information * 'https://statnet.org' for help, support, and other information > require(testthat) Loading required package: testthat > > test<-network.initialize(10) > add.edges.active(test,head=1:9,tail=2:10,onset=0,terminus=10) > add.edges.active(test,head=1,tail=3,onset=1,terminus=2) > proximity.timeline(test) collapsing slice networks ... computing vertex positions using 1D isoMDS layout ... computing positions for slice 1 computing positions for slice 2 computing positions for slice 3 computing positions for slice 4 rendering splines for each vertex ... > > data(McFarland_cls33_10_16_96) > proximity.timeline(cls33_10_16_96,onsets=seq(0,45,5),termini=seq(2.5,47.5,5),vertex.cex=(cls33_10_16_96%v%'type'=='instructor')*4+1,labels.at=45) collapsing slice networks ... computing vertex positions using 1D isoMDS layout ... computing positions for slice 1 computing positions for slice 2 computing positions for slice 3 computing positions for slice 4 computing positions for slice 5 computing positions for slice 6 computing positions for slice 7 computing positions for slice 8 computing positions for slice 9 computing positions for slice 10 rendering splines for each vertex ... > > # test algorithm types > # COMMENTING BECAUSE SKIP ON CRAN NOT WORKING > # test_that("algorithms work",{ > # # isoMDS is default, so already tested > # proximity.timeline(cls33_10_16_96,onsets=seq(0,45,5),termini=seq(2.5,47.5,5),mode='sammon') > # proximity.timeline(cls33_10_16_96,onsets=seq(0,45,5),termini=seq(2.5,47.5,5),mode='cmdscale') > # proximity.timeline(cls33_10_16_96,onsets=seq(0,45,5),termini=seq(2.5,47.5,5),mode='gvNeato') > # # only check MDSJ if allready installed (and not on CRAN) > # skip_on_cran() > # has.mdsj<-ndtv:::check.mdsj(ask=FALSE) > # if(!is.null(has.mdsj)){ > # proximity.timeline(cls33_10_16_96,onsets=seq(0,45,5),termini=seq(2.5,47.5,5),mode='MDSJ') > # } > # > # }) > > # test grid option and verbose options > proximity.timeline(cls33_10_16_96,onsets=seq(0,10,5),termini=seq(2.5,12.5,5),grid=FALSE,verbose=FALSE) > > # this is too slow for automated test > #data(msm.sim) > #proximity.timeline(msm.sim,start=0,end=10,mode='sammon',vertex.col=ifelse(msm.sim%v%'race'==1,rgb(0,.5,0,0.2),rgb(0,0,.5,0.2))) > > # sampson monestary > #require(ergm) > #data(samplk) > #sampdyn<-networkDynamic(network.list=list(samplk1,samplk2,samplk3)) > #proximity.timeline(sampdyn,labels.at=2.5,vertex.col='group',mode='sammon',default.dist=1) > > # tests for chunks missing data > # windsurfers > data(windsurfers) > proximity.timeline(windsurfers,start=20,end=31,vertex.col=ifelse(windsurfers%v%'group1','#000055ff','#55555555'),grid=F,splines=.5,mode='sammon') collapsing slice networks ... computing vertex positions using 1D sammon layout ... computing positions for slice 1 computing positions for slice 2 computing positions for slice 3 computing positions for slice 4 computing positions for slice 5 computing positions for slice 6 computing positions for slice 7 computing positions for slice 8 computing positions for slice 9 computing positions for slice 10 computing positions for slice 11 rendering splines for each vertex ... > > # check the various spline styles # spline.style=c('default','inactive.ghost','inactive.gaps','inactive.ignore','color.attribute') > proximity.timeline(windsurfers,start=20,end=31,vertex.col=ifelse(windsurfers%v%'group1','#000055ff','#55555555'),grid=F,splines=.5,mode='sammon',spline.style='inactive.ghost') collapsing slice networks ... computing vertex positions using 1D sammon layout ... computing positions for slice 1 computing positions for slice 2 computing positions for slice 3 computing positions for slice 4 computing positions for slice 5 computing positions for slice 6 computing positions for slice 7 computing positions for slice 8 computing positions for slice 9 computing positions for slice 10 computing positions for slice 11 rendering splines for each vertex ... > proximity.timeline(windsurfers,start=20,end=31,vertex.col=ifelse(windsurfers%v%'group1','#000055ff','#55555555'),grid=F,splines=.5,mode='sammon',spline.style='inactive.gaps') collapsing slice networks ... computing vertex positions using 1D sammon layout ... computing positions for slice 1 computing positions for slice 2 computing positions for slice 3 computing positions for slice 4 computing positions for slice 5 computing positions for slice 6 computing positions for slice 7 computing positions for slice 8 computing positions for slice 9 computing positions for slice 10 computing positions for slice 11 rendering splines for each vertex ... > proximity.timeline(windsurfers,start=20,end=31,vertex.col=ifelse(windsurfers%v%'group1','#000055ff','#55555555'),grid=F,splines=.5,mode='sammon',spline.style='inactive.ignore') collapsing slice networks ... computing vertex positions using 1D sammon layout ... computing positions for slice 1 computing positions for slice 2 computing positions for slice 3 computing positions for slice 4 computing positions for slice 5 computing positions for slice 6 computing positions for slice 7 computing positions for slice 8 computing positions for slice 9 computing positions for slice 10 computing positions for slice 11 rendering splines for each vertex ... > proximity.timeline(windsurfers,start=20,end=31,vertex.col=ifelse(windsurfers%v%'group1','#000055ff','#55555555'),grid=F,splines=.5,mode='sammon',spline.style='color.attribute') collapsing slice networks ... computing vertex positions using 1D sammon layout ... computing positions for slice 1 computing positions for slice 2 computing positions for slice 3 computing positions for slice 4 computing positions for slice 5 computing positions for slice 6 computing positions for slice 7 computing positions for slice 8 computing positions for slice 9 computing positions for slice 10 computing positions for slice 11 rendering splines for each vertex ... > > expect_error(proximity.timeline(windsurfers,start=20,end=31,draw.inactive='default'),regexp ='argument has been deprecated') > > > > > #data(newcomb) > #newDyn<-networkDynamic(network.list=newcomb,onsets=c(0:7,9:14),termini=c(1:8,10:15)) > > # test changing color attributes > test<-network.initialize(10,directed=FALSE) > activate.vertex.attribute(test,'color','gray',onset=-1,terminus=100) > add.edges.active(test,tail=c(9,7,3),head=c(7,3,9),onset=0,terminus=6) > activate.vertex.attribute(test,'color','red',onset=1,terminus=100,v=5) > add.edges.active(test,tail=5,head=6,onset=2,terminus=5) > activate.vertex.attribute(test,'color','red',onset=3,terminus=100,v=6) > add.edges.active(test,tail=6,head=1,onset=4,terminus=100) > activate.vertex.attribute(test,'color','red',onset=5,terminus=100,v=1) > > # test tea color attribute > proximity.timeline(test,vertex.col='color',start=0,end=10,mode='sammon',spline.style='color.attribute',default.dist=20,labels.at=10) collapsing slice networks ... computing vertex positions using 1D sammon layout ... computing positions for slice 1 computing positions for slice 2 computing positions for slice 3 computing positions for slice 4 computing positions for slice 5 computing positions for slice 6 computing positions for slice 7 computing positions for slice 8 computing positions for slice 9 computing positions for slice 10 assuming dynamic colors rendering splines for each vertex ... > > # test tea color but not using color.attribute splines > expect_error(proximity.timeline(test,vertex.col='color',start=0,end=10,default.dist=20,labels.at=10),regexp = "can only be used with spline.style='color.attribute'") collapsing slice networks ... computing vertex positions using 1D isoMDS layout ... computing positions for slice 1 computing positions for slice 2 computing positions for slice 3 computing positions for slice 4 computing positions for slice 5 computing positions for slice 6 computing positions for slice 7 computing positions for slice 8 computing positions for slice 9 computing positions for slice 10 > > # test the static color attributes > proximity.timeline(test,vertex.col=1:10,start=0,end=10,mode='sammon',default.dist=20,labels.at=10) # should be a sort of rainbow collapsing slice networks ... computing vertex positions using 1D sammon layout ... computing positions for slice 1 computing positions for slice 2 computing positions for slice 3 computing positions for slice 4 computing positions for slice 5 computing positions for slice 6 computing positions for slice 7 computing positions for slice 8 computing positions for slice 9 computing positions for slice 10 rendering splines for each vertex ... > > proximity.timeline(test,vertex.col='blue',start=0,end=10,mode='sammon',default.dist=20,labels.at=10) #all should be blue collapsing slice networks ... computing vertex positions using 1D sammon layout ... computing positions for slice 1 computing positions for slice 2 computing positions for slice 3 computing positions for slice 4 computing positions for slice 5 computing positions for slice 6 computing positions for slice 7 computing positions for slice 8 computing positions for slice 9 computing positions for slice 10 rendering splines for each vertex ... > > # test functional color attribute > expect_error(proximity.timeline(test,vertex.col=function(net){ifelse(net%v%'color'=='red','yellow','green')},start=0,end=10,mode='sammon',default.dist=20,labels.at=10)) collapsing slice networks ... computing vertex positions using 1D sammon layout ... computing positions for slice 1 computing positions for slice 2 computing positions for slice 3 computing positions for slice 4 computing positions for slice 5 computing positions for slice 6 computing positions for slice 7 computing positions for slice 8 computing positions for slice 9 computing positions for slice 10 > > proximity.timeline(test,vertex.col=function(slice){ifelse(slice%v%'color'=='red','yellow','green')},start=0,end=10,mode='sammon',default.dist=20,labels.at=10,spline.style='color.attribute') collapsing slice networks ... computing vertex positions using 1D sammon layout ... computing positions for slice 1 computing positions for slice 2 computing positions for slice 3 computing positions for slice 4 computing positions for slice 5 computing positions for slice 6 computing positions for slice 7 computing positions for slice 8 computing positions for slice 9 computing positions for slice 10 rendering splines for each vertex ... > > # test chain directions > proximity.timeline(test,start=0,end=10,default.dist=20,labels.at=10,chain.direction='forward') collapsing slice networks ... computing vertex positions using 1D isoMDS layout ... computing positions for slice 1 computing positions for slice 2 computing positions for slice 3 computing positions for slice 4 computing positions for slice 5 computing positions for slice 6 computing positions for slice 7 computing positions for slice 8 computing positions for slice 9 computing positions for slice 10 rendering splines for each vertex ... > proximity.timeline(test,start=0,end=10,default.dist=20,labels.at=10,chain.direction='reverse') collapsing slice networks ... computing vertex positions using 1D isoMDS layout ... computing positions for slice 10 computing positions for slice 9 computing positions for slice 8 computing positions for slice 7 computing positions for slice 6 computing positions for slice 5 computing positions for slice 4 computing positions for slice 3 computing positions for slice 2 computing positions for slice 1 rendering splines for each vertex ... > > # test labels > # pass in vector of label values > proximity.timeline(test,start=0,end=10,labels.at=1,label=LETTERS[1:10]) collapsing slice networks ... computing vertex positions using 1D isoMDS layout ... computing positions for slice 1 computing positions for slice 2 computing positions for slice 3 computing positions for slice 4 computing positions for slice 5 computing positions for slice 6 computing positions for slice 7 computing positions for slice 8 computing positions for slice 9 computing positions for slice 10 rendering splines for each vertex ... > test%v%'mylabel'<-LETTERS[10:20] > proximity.timeline(test,start=0,end=10,labels.at=1,label='mylabel') collapsing slice networks ... computing vertex positions using 1D isoMDS layout ... computing positions for slice 1 computing positions for slice 2 computing positions for slice 3 computing positions for slice 4 computing positions for slice 5 computing positions for slice 6 computing positions for slice 7 computing positions for slice 8 computing positions for slice 9 computing positions for slice 10 rendering splines for each vertex ... > # test showing labels at multiple times > proximity.timeline(test,start=0,end=10,labels.at=c(1,5,10),label='mylabel') collapsing slice networks ... computing vertex positions using 1D isoMDS layout ... computing positions for slice 1 computing positions for slice 2 computing positions for slice 3 computing positions for slice 4 computing positions for slice 5 computing positions for slice 6 computing positions for slice 7 computing positions for slice 8 computing positions for slice 9 computing positions for slice 10 rendering splines for each vertex ... > > # test vertex.cex > proximity.timeline(test,start=0,end=10,vertex.cex=10) collapsing slice networks ... computing vertex positions using 1D isoMDS layout ... computing positions for slice 1 computing positions for slice 2 computing positions for slice 3 computing positions for slice 4 computing positions for slice 5 computing positions for slice 6 computing positions for slice 7 computing positions for slice 8 computing positions for slice 9 computing positions for slice 10 rendering splines for each vertex ... > proximity.timeline(test,start=0,end=10,vertex.cex=1:10) collapsing slice networks ... computing vertex positions using 1D isoMDS layout ... computing positions for slice 1 computing positions for slice 2 computing positions for slice 3 computing positions for slice 4 computing positions for slice 5 computing positions for slice 6 computing positions for slice 7 computing positions for slice 8 computing positions for slice 9 computing positions for slice 10 rendering splines for each vertex ... > test%v%'myVal'<-1:10 > proximity.timeline(test,start=0,end=10,vertex.cex='myVal') collapsing slice networks ... computing vertex positions using 1D isoMDS layout ... computing positions for slice 1 computing positions for slice 2 computing positions for slice 3 computing positions for slice 4 computing positions for slice 5 computing positions for slice 6 computing positions for slice 7 computing positions for slice 8 computing positions for slice 9 computing positions for slice 10 rendering splines for each vertex ... > > > > > > > > proc.time() user system elapsed 4.21 0.39 4.60