R Under development (unstable) (2024-06-30 r86854 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\RtmpuE9guo\file2789c7c0c1b03.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\RtmpuE9guo\file2789c28994a59.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\RtmpuE9guo\file2789c27c12102.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\RtmpuE9guo\file2789c34822126.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\RtmpuE9guo\file2789c37022e86.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\RtmpuE9guo\file2789c77653e76.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\RtmpuE9guo\file2789c34682092.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\RtmpuE9guo\file2789c23c36e16.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\RtmpuE9guo\file2789c52995d07.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\RtmpuE9guo\file2789c4e8a5d8b.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\RtmpuE9guo\file2789c41a5b25.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\RtmpuE9guo\file2789c658c8b1.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\RtmpuE9guo\file2789c4565154fhtml > > # 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\RtmpuE9guo\file2789c6a3059a2html > > # 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\RtmpuE9guo\file2789c4d3c480ehtml > > # 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\RtmpuE9guo\file2789c44677fd9html > > # 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\RtmpuE9guo\file2789c173c2259html > > # 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\RtmpuE9guo\file2789c41e24298html > > # 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\RtmpuE9guo\file2789c7cb54b14html > > # 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\RtmpuE9guo\file2789c15835286html > > > # 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\RtmpuE9guo\file2789c4fb95fd6.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\RtmpuE9guo\file2789c6b115e9d.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\RtmpuE9guo\file2789c2c7350ef.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\RtmpuE9guo\file2789c632f7043.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\RtmpuE9guo\file2789c74ba3eaa.html browser launching disabled because R is not in interactive mode > > > > > proc.time() user system elapsed 3.15 0.21 3.37