Adjust the activity ranges in all of the spells of a networkDynamic object
Transforms the values of all the activity spells of vertices and edges, as well as spells of dynamic TEA attributes (and the net.obs.period
if it exists).
adjust.activity(nd, offset = 0, factor = 1)
nd |
networkDynamic object to be modified |
offset |
numeric value to be added (or subtracted) to all spell values |
factor |
numeric factor for multiplying all spell values |
Spell values are modified by first adding the value of offset
and then multiplying by factor
. If a net.obs.period
attribute exists, it's observation spell values are transformed, and the time.increment
value is multiplied by factor
.
The nd
argument is modified in place and returned invisibly.
skyebend@uw.edu
See also activity.attribute
, attribute.activity.functions
and net.obs.period
# convert steps of an imaginary discrete sim # with each steps corresponding to 1 day # into decimal 'years' since 1990 sim<-network.initialize(5) activate.vertices(sim,onset=0,terminus=2546) add.edges.active(sim,head=1:4,tail=2:5,onset=0,terminus=2546) set.network.attribute(sim,'net.obs.period',list( observations=list(c(0,2546)),mode="discrete", time.increment=1,time.unit="step")) # do the transformation adjust.activity(sim,offset=1990*365.25,factor=1/365.25) # modify the 'units' of net.obs.period obs <-get.network.attribute(sim,'net.obs.period') obs$time.unit<-'year' set.network.attribute(sim,'net.obs.period',obs) # peek at the new values as.data.frame(sim) get.network.attribute(sim,'net.obs.period')
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.