set_vertex_spells: Replace declared vertex activity

View source: R/support-edit.R

set_vertex_spellsR Documentation

Replace declared vertex activity

Description

Replace declared vertex activity

Usage

set_vertex_spells(dn, data = NULL)

Arguments

dn

A temporal network.

data

A vertex-spell data frame with node, start, and end, plus optional session, onset_censored, and terminus_censored; or the string "ties", which declares each vertex present from the start of its first tie spell to the end of its last, so that a vertex is absent before it has had a tie and after it has had its last. Default NULL, which clears explicit activity, making every retained node implicitly active over observation support.

Value

A new dynet object, class c("dynet", "netobject", "cograph_network"), whose declared vertex activity is exactly data and whose edge spells, node attributes and metadata are those of dn. Overlapping or adjacent spells are canonicalised exactly as in dynet(), so canonical spell identifiers may change. Read the result back with as.data.frame(x, what = "vertex_spells"). Raises dynet_unknown_node when data names a vertex the network does not have, and dynet_bad_input for a string other than "ties".

Examples

dn <- dynet(school_contacts)
present <- data.frame(node = c("Ana", "Ben"), start = 0, end = 10)
enrolled <- set_vertex_spells(dn, present)
as.data.frame(enrolled, what = "vertex_spells")

# Present from the first contact to the last, vertex by vertex.
spanned <- set_vertex_spells(dn, "ties")
as.data.frame(spanned, what = "vertex_spells")

Dynet documentation built on Oct. 7, 2026, 5:08 p.m.