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. > # File tests/d3_animation_tests.R in package ndtv, part of the Statnet suite > # of packages for network analysis, http://statnet.org . > # > # This software is distributed under the GPL-3 license. It is free, > # open source, and has the attribution requirements (GPL Section 7) at > # http://statnet.org/attribution > # > # Copyright 2014 Statnet Commons > ####################################################################### > > # tests for d3 animation functionality > library(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 > > # flip this to true if you actually want it to open a gajillion browser windows > showInBrowser=FALSE > > # create really trivial network for testing > test<-network.initialize(3) > activate.vertices(test,v=1,onset=1,terminus=3) > activate.vertices(test,v=3:3,onset=0,terminus=5) > add.edges.active(test,tail=2,head=3,onset=1,terminus=5) > > # test output formats > render.d3movie(test,filename=tempfile(fileext = '.html'),launchBrowser = showInBrowser) No slice.par found, using slice parameters: start:0 end:5 interval:1 aggregate.dur:1 rule:latest Calculating layout for network slice from time 0 to 1 Calculating layout for network slice from time 1 to 2 Calculating layout for network slice from time 2 to 3 Calculating layout for network slice from time 3 to 4 Calculating layout for network slice from time 4 to 5 Calculating layout for network slice from time 5 to 6 caching 10 properties for slice 0 caching 10 properties for slice 1 caching 10 properties for slice 2 caching 10 properties for slice 3 caching 10 properties for slice 4 caching 10 properties for slice 5 wrote animation HTML file to D:\temp\RtmpoDST2v\file1efdc5f8dd27.html > render.d3movie(test,filename=tempfile(fileext = '.json'),output.mode='JSON') No slice.par found, using slice parameters: start:0 end:5 interval:1 aggregate.dur:1 rule:latest Calculating layout for network slice from time 0 to 1 Calculating layout for network slice from time 1 to 2 Calculating layout for network slice from time 2 to 3 Calculating layout for network slice from time 3 to 4 Calculating layout for network slice from time 4 to 5 Calculating layout for network slice from time 5 to 6 caching 10 properties for slice 0 caching 10 properties for slice 1 caching 10 properties for slice 2 caching 10 properties for slice 3 caching 10 properties for slice 4 caching 10 properties for slice 5 wrote animation JSON representation to D:\temp\RtmpoDST2v\file1efdc724b6abd.json > > # test browser launch > render.d3movie(test,filename=tempfile(fileext = '.json'),output.mode='JSON',launchBrowser = showInBrowser) No slice.par found, using slice parameters: start:0 end:5 interval:1 aggregate.dur:1 rule:latest Calculating layout for network slice from time 0 to 1 Calculating layout for network slice from time 1 to 2 Calculating layout for network slice from time 2 to 3 Calculating layout for network slice from time 3 to 4 Calculating layout for network slice from time 4 to 5 Calculating layout for network slice from time 5 to 6 caching 10 properties for slice 0 caching 10 properties for slice 1 caching 10 properties for slice 2 caching 10 properties for slice 3 caching 10 properties for slice 4 caching 10 properties for slice 5 wrote animation JSON representation to D:\temp\RtmpoDST2v\file1efdc74bd7bea.json > > # test xlab > render.d3movie(test,filename=tempfile(fileext = '.html'),xlab='hello, xlabel',launchBrowser=showInBrowser) No slice.par found, using slice parameters: start:0 end:5 interval:1 aggregate.dur:1 rule:latest Calculating layout for network slice from time 0 to 1 Calculating layout for network slice from time 1 to 2 Calculating layout for network slice from time 2 to 3 Calculating layout for network slice from time 3 to 4 Calculating layout for network slice from time 4 to 5 Calculating layout for network slice from time 5 to 6 caching 10 properties for slice 0 caching 10 properties for slice 1 caching 10 properties for slice 2 caching 10 properties for slice 3 caching 10 properties for slice 4 caching 10 properties for slice 5 wrote animation HTML file to D:\temp\RtmpoDST2v\file1efdc394a126.html > > # test main > render.d3movie(test,filename=tempfile(fileext = '.html'),main='hello, main',launchBrowser=showInBrowser) No slice.par found, using slice parameters: start:0 end:5 interval:1 aggregate.dur:1 rule:latest Calculating layout for network slice from time 0 to 1 Calculating layout for network slice from time 1 to 2 Calculating layout for network slice from time 2 to 3 Calculating layout for network slice from time 3 to 4 Calculating layout for network slice from time 4 to 5 Calculating layout for network slice from time 5 to 6 caching 10 properties for slice 0 caching 10 properties for slice 1 caching 10 properties for slice 2 caching 10 properties for slice 3 caching 10 properties for slice 4 caching 10 properties for slice 5 wrote animation HTML file to D:\temp\RtmpoDST2v\file1efdc7f8a40a2.html > > # test displaylabels > render.d3movie(test,filename=tempfile(fileext = '.html'),displaylabels=FALSE,launchBrowser=showInBrowser) No slice.par found, using slice parameters: start:0 end:5 interval:1 aggregate.dur:1 rule:latest Calculating layout for network slice from time 0 to 1 Calculating layout for network slice from time 1 to 2 Calculating layout for network slice from time 2 to 3 Calculating layout for network slice from time 3 to 4 Calculating layout for network slice from time 4 to 5 Calculating layout for network slice from time 5 to 6 caching 10 properties for slice 0 caching 10 properties for slice 1 caching 10 properties for slice 2 caching 10 properties for slice 3 caching 10 properties for slice 4 caching 10 properties for slice 5 wrote animation HTML file to D:\temp\RtmpoDST2v\file1efdc4e036398.html > > # test use arrows > render.d3movie(test,filename=tempfile(fileext = '.html'),usearrows=FALSE,launchBrowser=showInBrowser) No slice.par found, using slice parameters: start:0 end:5 interval:1 aggregate.dur:1 rule:latest Calculating layout for network slice from time 0 to 1 Calculating layout for network slice from time 1 to 2 Calculating layout for network slice from time 2 to 3 Calculating layout for network slice from time 3 to 4 Calculating layout for network slice from time 4 to 5 Calculating layout for network slice from time 5 to 6 caching 10 properties for slice 0 caching 10 properties for slice 1 caching 10 properties for slice 2 caching 10 properties for slice 3 caching 10 properties for slice 4 caching 10 properties for slice 5 wrote animation HTML file to D:\temp\RtmpoDST2v\file1efdc1aa13b59.html > > # test bg > render.d3movie(test,filename=tempfile(fileext = '.html'),bg='red',launchBrowser=showInBrowser) No slice.par found, using slice parameters: start:0 end:5 interval:1 aggregate.dur:1 rule:latest Calculating layout for network slice from time 0 to 1 Calculating layout for network slice from time 1 to 2 Calculating layout for network slice from time 2 to 3 Calculating layout for network slice from time 3 to 4 Calculating layout for network slice from time 4 to 5 Calculating layout for network slice from time 5 to 6 caching 10 properties for slice 0 caching 10 properties for slice 1 caching 10 properties for slice 2 caching 10 properties for slice 3 caching 10 properties for slice 4 caching 10 properties for slice 5 wrote animation HTML file to D:\temp\RtmpoDST2v\file1efdc40281388.html > > # test vertex.cex > render.d3movie(test,filename=tempfile(fileext = '.html'),vertex.cex=5,launchBrowser=showInBrowser) No slice.par found, using slice parameters: start:0 end:5 interval:1 aggregate.dur:1 rule:latest Calculating layout for network slice from time 0 to 1 Calculating layout for network slice from time 1 to 2 Calculating layout for network slice from time 2 to 3 Calculating layout for network slice from time 3 to 4 Calculating layout for network slice from time 4 to 5 Calculating layout for network slice from time 5 to 6 caching 10 properties for slice 0 caching 10 properties for slice 1 caching 10 properties for slice 2 caching 10 properties for slice 3 caching 10 properties for slice 4 caching 10 properties for slice 5 wrote animation HTML file to D:\temp\RtmpoDST2v\file1efdc6fec2360.html > > # test vertex label > render.d3movie(test,filename=tempfile(fileext = '.html'),label="we all have the same label",launchBrowser=showInBrowser) No slice.par found, using slice parameters: start:0 end:5 interval:1 aggregate.dur:1 rule:latest Calculating layout for network slice from time 0 to 1 Calculating layout for network slice from time 1 to 2 Calculating layout for network slice from time 2 to 3 Calculating layout for network slice from time 3 to 4 Calculating layout for network slice from time 4 to 5 Calculating layout for network slice from time 5 to 6 caching 10 properties for slice 0 caching 10 properties for slice 1 caching 10 properties for slice 2 caching 10 properties for slice 3 caching 10 properties for slice 4 caching 10 properties for slice 5 wrote animation HTML file to D:\temp\RtmpoDST2v\file1efdca947df9.html > > # test label cex > render.d3movie(test,filename=tempfile(fileext = '.html'),label.cex=c(0.5,2,4),launchBrowser=showInBrowser,displaylabels=TRUE) No slice.par found, using slice parameters: start:0 end:5 interval:1 aggregate.dur:1 rule:latest Calculating layout for network slice from time 0 to 1 Calculating layout for network slice from time 1 to 2 Calculating layout for network slice from time 2 to 3 Calculating layout for network slice from time 3 to 4 Calculating layout for network slice from time 4 to 5 Calculating layout for network slice from time 5 to 6 caching 10 properties for slice 0 caching 10 properties for slice 1 caching 10 properties for slice 2 caching 10 properties for slice 3 caching 10 properties for slice 4 caching 10 properties for slice 5 wrote animation HTML file to D:\temp\RtmpoDST2v\file1efdc5fb721e7.html > > # test vertex label color > render.d3movie(test,filename=tempfile(fileext = '.html'),label.col='red',launchBrowser=showInBrowser,displaylabels=TRUE) No slice.par found, using slice parameters: start:0 end:5 interval:1 aggregate.dur:1 rule:latest Calculating layout for network slice from time 0 to 1 Calculating layout for network slice from time 1 to 2 Calculating layout for network slice from time 2 to 3 Calculating layout for network slice from time 3 to 4 Calculating layout for network slice from time 4 to 5 Calculating layout for network slice from time 5 to 6 caching 10 properties for slice 0 caching 10 properties for slice 1 caching 10 properties for slice 2 caching 10 properties for slice 3 caching 10 properties for slice 4 caching 10 properties for slice 5 wrote animation HTML file to D:\temp\RtmpoDST2v\file1efdc138daab.html > > # test vertex color > render.d3movie(test,filename=tempfile(fileext = 'html'),vertex.col='blue',launchBrowser=showInBrowser) No slice.par found, using slice parameters: start:0 end:5 interval:1 aggregate.dur:1 rule:latest Calculating layout for network slice from time 0 to 1 Calculating layout for network slice from time 1 to 2 Calculating layout for network slice from time 2 to 3 Calculating layout for network slice from time 3 to 4 Calculating layout for network slice from time 4 to 5 Calculating layout for network slice from time 5 to 6 caching 10 properties for slice 0 caching 10 properties for slice 1 caching 10 properties for slice 2 caching 10 properties for slice 3 caching 10 properties for slice 4 caching 10 properties for slice 5 wrote animation HTML file to D:\temp\RtmpoDST2v\file1efdc23127acbhtml > > # test vertex sides > render.d3movie(test,filename=tempfile(fileext = 'html'),vertex.sides=3,launchBrowser=showInBrowser) No slice.par found, using slice parameters: start:0 end:5 interval:1 aggregate.dur:1 rule:latest Calculating layout for network slice from time 0 to 1 Calculating layout for network slice from time 1 to 2 Calculating layout for network slice from time 2 to 3 Calculating layout for network slice from time 3 to 4 Calculating layout for network slice from time 4 to 5 Calculating layout for network slice from time 5 to 6 caching 10 properties for slice 0 caching 10 properties for slice 1 caching 10 properties for slice 2 caching 10 properties for slice 3 caching 10 properties for slice 4 caching 10 properties for slice 5 wrote animation HTML file to D:\temp\RtmpoDST2v\file1efdc2462b8fhtml > > # vertex rotation > render.d3movie(test,filename=tempfile(fileext = 'html'),vertex.sides=3,vertex.rot=c(0,90,180),launchBrowser=showInBrowser) No slice.par found, using slice parameters: start:0 end:5 interval:1 aggregate.dur:1 rule:latest Calculating layout for network slice from time 0 to 1 Calculating layout for network slice from time 1 to 2 Calculating layout for network slice from time 2 to 3 Calculating layout for network slice from time 3 to 4 Calculating layout for network slice from time 4 to 5 Calculating layout for network slice from time 5 to 6 caching 10 properties for slice 0 caching 10 properties for slice 1 caching 10 properties for slice 2 caching 10 properties for slice 3 caching 10 properties for slice 4 caching 10 properties for slice 5 wrote animation HTML file to D:\temp\RtmpoDST2v\file1efdc6d7637afhtml > > # vertex border color > render.d3movie(test,filename=tempfile(fileext = 'html'),vertex.border='green',launchBrowser=showInBrowser) No slice.par found, using slice parameters: start:0 end:5 interval:1 aggregate.dur:1 rule:latest Calculating layout for network slice from time 0 to 1 Calculating layout for network slice from time 1 to 2 Calculating layout for network slice from time 2 to 3 Calculating layout for network slice from time 3 to 4 Calculating layout for network slice from time 4 to 5 Calculating layout for network slice from time 5 to 6 caching 10 properties for slice 0 caching 10 properties for slice 1 caching 10 properties for slice 2 caching 10 properties for slice 3 caching 10 properties for slice 4 caching 10 properties for slice 5 wrote animation HTML file to D:\temp\RtmpoDST2v\file1efdcda87dhtml > > # vertex border width > render.d3movie(test,filename=tempfile(fileext = 'html'),vertex.lwd=5,launchBrowser=showInBrowser) No slice.par found, using slice parameters: start:0 end:5 interval:1 aggregate.dur:1 rule:latest Calculating layout for network slice from time 0 to 1 Calculating layout for network slice from time 1 to 2 Calculating layout for network slice from time 2 to 3 Calculating layout for network slice from time 3 to 4 Calculating layout for network slice from time 4 to 5 Calculating layout for network slice from time 5 to 6 caching 10 properties for slice 0 caching 10 properties for slice 1 caching 10 properties for slice 2 caching 10 properties for slice 3 caching 10 properties for slice 4 caching 10 properties for slice 5 wrote animation HTML file to D:\temp\RtmpoDST2v\file1efdc51ab94ehtml > > # test edge color > render.d3movie(test,filename=tempfile(fileext = 'html'),edge.col='blue',launchBrowser=showInBrowser) No slice.par found, using slice parameters: start:0 end:5 interval:1 aggregate.dur:1 rule:latest Calculating layout for network slice from time 0 to 1 Calculating layout for network slice from time 1 to 2 Calculating layout for network slice from time 2 to 3 Calculating layout for network slice from time 3 to 4 Calculating layout for network slice from time 4 to 5 Calculating layout for network slice from time 5 to 6 caching 10 properties for slice 0 caching 10 properties for slice 1 caching 10 properties for slice 2 caching 10 properties for slice 3 caching 10 properties for slice 4 caching 10 properties for slice 5 wrote animation HTML file to D:\temp\RtmpoDST2v\file1efdc28526329html > > # test edge width > render.d3movie(test,filename=tempfile(fileext = 'html'),edge.lwd=10,launchBrowser=showInBrowser) No slice.par found, using slice parameters: start:0 end:5 interval:1 aggregate.dur:1 rule:latest Calculating layout for network slice from time 0 to 1 Calculating layout for network slice from time 1 to 2 Calculating layout for network slice from time 2 to 3 Calculating layout for network slice from time 3 to 4 Calculating layout for network slice from time 4 to 5 Calculating layout for network slice from time 5 to 6 caching 10 properties for slice 0 caching 10 properties for slice 1 caching 10 properties for slice 2 caching 10 properties for slice 3 caching 10 properties for slice 4 caching 10 properties for slice 5 wrote animation HTML file to D:\temp\RtmpoDST2v\file1efdc6de8530fhtml > > # test transparent edge color > render.d3movie(test,filename=tempfile(fileext = 'html'),edge.col='#CCCCCC22',edge.lwd=10,launchBrowser=showInBrowser) No slice.par found, using slice parameters: start:0 end:5 interval:1 aggregate.dur:1 rule:latest Calculating layout for network slice from time 0 to 1 Calculating layout for network slice from time 1 to 2 Calculating layout for network slice from time 2 to 3 Calculating layout for network slice from time 3 to 4 Calculating layout for network slice from time 4 to 5 Calculating layout for network slice from time 5 to 6 caching 10 properties for slice 0 caching 10 properties for slice 1 caching 10 properties for slice 2 caching 10 properties for slice 3 caching 10 properties for slice 4 caching 10 properties for slice 5 wrote animation HTML file to D:\temp\RtmpoDST2v\file1efdc2ddf6f54html > > > # test static network > testStatic<-network.initialize(4) > testStatic[1,2:3]<-1 > render.d3movie(testStatic) input network is not networkDynamic object and does not have temporal info so output animation controls disabled by default Calculating layout for network slice from time 0 to 0 caching 10 properties for slice 0 wrote animation HTML file to D:\temp\RtmpoDST2v\file1efdc233d14db.html browser launching disabled because R is not in interactive mode > > # test passing in coord to static network > testStatic<-network.initialize(4) > testStatic[1,2:3]<-1 > render.d3movie(testStatic,coord=matrix(1:8,ncol=2)) input network is not networkDynamic object and does not have temporal info so output animation controls disabled by default caching 10 properties for slice 0 wrote animation HTML file to D:\temp\RtmpoDST2v\file1efdc75675b3f.html browser launching disabled because R is not in interactive mode > > # test rendering network of size zero (issue #24) > test<-network.initialize(0) > activate.vertices(test) > activate.vertex.attribute(test,'foo',1,onset=0,terminus=1) > render.d3movie(test,vertex.cex='foo') No slice.par found, using slice parameters: start:0 end:0 interval:1 aggregate.dur:1 rule:latest Calculating layout for network slice from time 0 to 1 caching 10 properties for slice 0 wrote animation HTML file to D:\temp\RtmpoDST2v\file1efdc5c2e272b.html browser launching disabled because R is not in interactive mode There were 13 warnings (use warnings() to see them) > > # test rendering of edge attribute for network with edge not active # 25 > test<-network.initialize(2) > add.edges.active(test,1,2,onset=0,terminus=2) > activate.edge.attribute(test,'weight',1, onset=0,terminus=2) > compute.animation(test,slice.par = list(start=3,end=4,interval=1,aggregate.dur=1,rule='earliest')) Calculating layout for network slice from time 3 to 4 Calculating layout for network slice from time 4 to 5 > render.d3movie(test,edge.lwd='weight') caching 10 properties for slice 0 caching 10 properties for slice 1 wrote animation HTML file to D:\temp\RtmpoDST2v\file1efdc6d483465.html browser launching disabled because R is not in interactive mode > > # test rendering of edge attribute for network with attribute not active > # (should give error because do 'default' attribute is defined) > test<-network.initialize(2) > add.edges.active(test,1,2,onset=0,terminus=2) > activate.edge.attribute(test,'weight',1, onset=1,terminus=2) > expect_error( render.d3movie(test,edge.lwd='weight'),regexp = 'had illegal missing values for') No slice.par found, using slice parameters: start:0 end:2 interval:1 aggregate.dur:1 rule:latest Calculating layout for network slice from time 0 to 1 Calculating layout for network slice from time 1 to 2 Calculating layout for network slice from time 2 to 3 caching 10 properties for slice 0 > > #errors on empty slice with vertex.cex specified > #https://github.com/statnet/ndtv/issues/24 > test<-network.initialize(2) > add.edges.active(test,1,2,onset=0,terminus=1) > activate.edge.attribute(test,'edge.col','blue',onset = 0,terminus=1) > render.d3movie(test,edge.col='edge.col') No slice.par found, using slice parameters: start:0 end:1 interval:1 aggregate.dur:1 rule:latest Calculating layout for network slice from time 0 to 1 Calculating layout for network slice from time 1 to 2 caching 10 properties for slice 0 caching 10 properties for slice 1 wrote animation HTML file to D:\temp\RtmpoDST2v\file1efdc26a17d65.html browser launching disabled because R is not in interactive mode > > > > > proc.time() user system elapsed 4.73 0.40 5.14