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/networkAnimationTest.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 2003-2012 Statnet Commons > ####################################################################### > #test some auxillury functions for calculating layouts etc. > 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 > > > # ----- java tests ---- > > # does the check for java crash? > ndtv:::check.java() [1] TRUE > > # ----- ffmpeg tests ----- > # does the check for ffmpeg crash? > try(ndtv:::check.ffmpeg()) # this fails if no ffmpeg, so would stop the test on cran [1] FALSE Warning message: In ndtv:::check.ffmpeg() : The ffmpeg video utility does not appear to be installed on the system, or the path is not set correctly. Please run ndtv:::install.ffmpeg() for more information > ndtv:::install.ffmpeg() To export movies, please install ffmpeg for windows from http://ffmpeg.zeranoe.com/builds/ type ?install.ffmpeg for more detailed instructions browser launching disabled because R is not in interactive mode > > # ---- layout.distance ----- > mat <-matrix(c(1,2,0,0, 0,0,0,0, 0,3,0,0, 0,0,0,0),ncol=4,byrow=TRUE) > net <- as.network(mat) > symat <-as.sociomatrix(layout.distance(net)) > if (!all(symat == matrix(c(0,1,2,2, 1,0,1,2, 2,1,0,2, 2,2,2,0),ncol=4,byrow=TRUE))){ + stop("layout.distance did not return symetric geodedesic distance matrix as expected") + } > > # does default dist work > symat <-as.sociomatrix(layout.distance(net,default.dist=20)) > if (!all(symat == matrix(c(0,1,2,20, 1,0,1,20, 2,1,0,20, 20,20,20,0),ncol=4,byrow=TRUE))){ + stop("layout.distance did not return symetric geodedesic distance with default.dist as expected") + } > > > # test using a function to specifiy a graphic plotting property > test<-network.initialize(5) > add.edges.active(test,onset=0,terminus=10,tail=1:4,head=2:5) > activate.vertices(test,v=5,onset=4,terminus=10) > activate.vertex.attribute(test,'status',0,onset=0,terminus=10) > activate.vertex.attribute(test,'status',1,onset=1,terminus=10,v=1) > activate.vertex.attribute(test,'status',1,onset=2,terminus=10,v=2) > activate.vertex.attribute(test,'status',1,onset=3,terminus=10,v=3) > activate.vertex.attribute(test,'status',1,onset=4,terminus=10,v=4) > compute.animation(test) No slice.par found, using slice parameters: start:0 end:10 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 Calculating layout for network slice from time 6 to 7 Calculating layout for network slice from time 7 to 8 Calculating layout for network slice from time 8 to 9 Calculating layout for network slice from time 9 to 10 Calculating layout for network slice from time 10 to 11 > render.animation(test,vertex.col=function(slice){ifelse(slice%v%'status'==1,'red','blue')}) rendering 10 frames for slice 0 rendering 10 frames for slice 1 rendering 10 frames for slice 2 rendering 10 frames for slice 3 rendering 10 frames for slice 4 rendering 10 frames for slice 5 rendering 10 frames for slice 6 rendering 10 frames for slice 7 rendering 10 frames for slice 8 rendering 10 frames for slice 9 rendering 10 frames for slice 10 > > > > > > > > > proc.time() user system elapsed 1.73 0.37 2.09