Replace observation support
Arguments
- dn
A temporal network.
- data
Optional data frame with
startandendobservation components. Overlapping and adjacent positive components are merged. DefaultNULL.- start, end
Optional scalar continuous bounds used instead of
data, each defaulting toNULL. Supply exactly one ofdataor thestart/endpair; supplying both, or neither, is an error.
Value
A new dynet object, class
c("dynet", "netobject", "cograph_network"). Raw edge and vertex spells
are unchanged – as.data.frame(x) still returns the originals – and
only the non-destructive measurement view is replaced, so every verb now
clips exposure and path horizons to this support. Read the components
back with as.data.frame(x, what = "observations"), one row per
component with observation, start, end, duration and instant.
The result is the network dynet() builds from the same log with
observation_spells = data, or with observation_start = start, observation_end = end, so either route measures identically; any
earlier observation support is replaced, not merged.
Raises dynet_bad_input when neither or both of data and the bounds
are given, or when end precedes start.
Examples
dn <- dynet(school_contacts)
first_week <- set_observations(dn, start = 0, end = 7)
as.data.frame(first_week, what = "observations")
#> observation start end duration instant
#> 1 1 0 7 7 FALSE