R Under development (unstable) (2024-07-02 r86866 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 (2024-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\Rtmpiw4tjf\file249d434a86661.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\Rtmpiw4tjf\file249d41f39735a.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\Rtmpiw4tjf\file249d4eb6887.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\Rtmpiw4tjf\file249d436395f44.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\Rtmpiw4tjf\file249d4ea91e1a.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\Rtmpiw4tjf\file249d47f593397.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\Rtmpiw4tjf\file249d43adf7532.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\Rtmpiw4tjf\file249d461266a37.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\Rtmpiw4tjf\file249d44f2d2aff.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\Rtmpiw4tjf\file249d415d93f08.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\Rtmpiw4tjf\file249d4183618a6.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\Rtmpiw4tjf\file249d414db362.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\Rtmpiw4tjf\file249d43b4a424bhtml > > # 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\Rtmpiw4tjf\file249d4358845bfhtml > > # 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\Rtmpiw4tjf\file249d4f435c6fhtml > > # 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\Rtmpiw4tjf\file249d46f3421b7html > > # 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\Rtmpiw4tjf\file249d47cac3b7dhtml > > # 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\Rtmpiw4tjf\file249d45a6b4c2fhtml > > # 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\Rtmpiw4tjf\file249d42929619fhtml > > # 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\Rtmpiw4tjf\file249d4577d2fcdhtml > > > # 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\Rtmpiw4tjf\file249d472121ed6.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\Rtmpiw4tjf\file249d47e3a2daf.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\Rtmpiw4tjf\file249d47a62774a.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\Rtmpiw4tjf\file249d43afb565c.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\Rtmpiw4tjf\file249d44fd043df.html browser launching disabled because R is not in interactive mode > > > > > proc.time() user system elapsed 2.70 0.37 3.07