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/render.animation_test.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-2013 Statnet Commons > ####################################################################### > #test some functions for calculating animated layouts and exporting movies. > 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 > > # hard to write tests since most require a human looking at the output > # most overall tests are included as man examples or in the packae vignette > # this file should be mostly unit tests for functionality > data(newcomb) > dynNew <- networkDynamic(network.list=newcomb[1:5]) Neither start or onsets specified, assuming start=0 Onsets and termini not specified, assuming each network in network.list should have a discrete spell of length 1 Argument base.net not specified, using first element of network.list instead Created net.obs.period to describe network Network observation period info: Number of observation spells: 1 Maximal time range observed: 0 until 5 Temporal mode: discrete Time unit: step Suggested time increment: 1 > > #----- render animation ------ > # does it crash on basic example > # shorten time range so wont dake as long > dyn<-network.extract(dynNew,onset=0,terminus=3,trim.spells=TRUE) > render.animation(dyn,verbose=FALSE) > > # does replay work > ani.replay() > > # can it run and record plots without creating alist of animations > saveVideo(render.animation(dyn,verbose=FALSE,render.cache='none')) Error in system(paste(ffmpeg, "-version"), intern = TRUE) : '"ffmpeg"' not found NULL Warning message: In saveVideo(render.animation(dyn, verbose = FALSE, render.cache = "none")) : The command ""ffmpeg"" is not available in your system. Please install FFmpeg or avconv first: http://ffmpeg.org/download.html > > > # does increasing tween produce different results > > # does show.time crash if changed from default > render.par<-list(tween.frames=2,show.time=FALSE) > render.animation(dyn,render.par=render.par,verbose=FALSE) > > # does show.stats crashed if changed from default > render.par<-list(tween.frames=2,show.time=TRUE,show.stats=FALSE) > render.animation(dyn,render.par=render.par,verbose=FALSE) > > # can it render arbitrary plotting comands? > render.par=list(tween.frames=2,show.time=TRUE,show.stats=NULL,extraPlotCmds=expression(text(0,0,"SOME TEXT ON THE PLOT",col='blue'))) > render.animation(dyn,render.par=render.par,verbose=FALSE) > > # test workaround for 0-coord label bug #322 > test<-network.initialize(2) > activate.vertex.attribute(test,'x',0,onset=0,terminus=2) > activate.vertex.attribute(test,'y',0,onset=0,terminus=2) > compute.animation(test, animation.mode='useAttribute',layout.par = list(x = "x", y = "y"),slice.par=list(start=0,end=1,interval=1,aggregate.dur=0,rule='latest')) Calculating layout for network slice from time 0 to 0 Calculating layout for network slice from time 1 to 1 > render.animation(test,displaylabels=TRUE) rendering 10 frames for slice 0 rendering 10 frames for slice 1 > > # try labels moving on edges, but only 5 edges > set.edge.attribute(dyn,"eLabel",1:network.edgecount(dyn)) > render.par=list(tween.frames=10,show.time=TRUE,show.stats=NULL) > render.animation(dyn,render.par=render.par,verbose=FALSE,edge.col='gray',edge.label='eLabel',edge.label.cex=0.7,edge.label.col='blue') > > # single vertex matrix collapse bug #332 > compute.animation(as.networkDynamic(network.initialize(1))) 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 Warning message: In guessSlicePar(net) : network does not appear to have any dynamic information. Using start=0 end=1 > > # test animation of single vertex > test<-network.initialize(3) > deactivate.vertices(test) > activate.vertices(test,v=2,onset=0,terminus=3) > compute.animation(test) No slice.par found, using slice parameters: start:0 end:3 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 > render.animation(test) rendering 10 frames for slice 0 rendering 10 frames for slice 1 rendering 10 frames for slice 2 rendering 10 frames for slice 3 > > # test specifying xlim and ylim > render.animation(test,xlim=c(-1,1),ylim=c(-1,1)) rendering 10 frames for slice 0 rendering 10 frames for slice 1 rendering 10 frames for slice 2 rendering 10 frames for slice 3 > > proc.time() user system elapsed 3.53 0.39 3.85