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\RtmpErIfhV\file132ec6136139a.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\RtmpErIfhV\file132ec14205f2d.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\RtmpErIfhV\file132ec1d203726.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\RtmpErIfhV\file132ec19e319f1.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\RtmpErIfhV\file132ec30ed36b6.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\RtmpErIfhV\file132ec54937f02.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\RtmpErIfhV\file132ec7e932277.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\RtmpErIfhV\file132ec31792d17.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\RtmpErIfhV\file132ec363d4f6.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\RtmpErIfhV\file132ec7fbc2a4a.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\RtmpErIfhV\file132ec2af27536.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\RtmpErIfhV\file132eca2726c9.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\RtmpErIfhV\file132ec5a71f00html > > # 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\RtmpErIfhV\file132ec7e2d57cehtml > > # 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\RtmpErIfhV\file132ec2c60457ahtml > > # 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\RtmpErIfhV\file132ec442a7ed1html > > # 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\RtmpErIfhV\file132ec2ca643fbhtml > > # 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\RtmpErIfhV\file132ec2cec70fchtml > > # 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\RtmpErIfhV\file132ec4516511ehtml > > # 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\RtmpErIfhV\file132ec187232dfhtml > > > # 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\RtmpErIfhV\file132ec3a4d6815.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\RtmpErIfhV\file132ec79f37c65.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\RtmpErIfhV\file132ec6fdd7c40.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\RtmpErIfhV\file132ec5d233906.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\RtmpErIfhV\file132ec37ab1afe.html browser launching disabled because R is not in interactive mode > > > > > proc.time() user system elapsed 3.28 0.26 3.54