Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

adjust.activity

Adjust the activity ranges in all of the spells of a networkDynamic object


Description

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).

Usage

adjust.activity(nd, offset = 0, factor = 1)

Arguments

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

Details

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.

Value

The nd argument is modified in place and returned invisibly.

Author(s)

skyebend@uw.edu

See Also

Examples

# 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')

networkDynamic

Dynamic Extensions for Network Objects

v0.10.1
GPL-3
Authors
Carter T. Butts [aut], Ayn Leslie-Cook [aut], Pavel N. Krivitsky [aut], Skye Bender-deMoll [aut, cre], Zack Almquist [ctb], David R. Hunter [ctb], Li Wang [ctb], Kirk Li [ctb], Steven M. Goodreau [ctb], Jeffrey Horner [ctb], Martina Morris [ctb]
Initial release
2020-01-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.