| dynet | R Documentation |
Builds a temporal network from a relational log. One constructor covers the four shapes relational data actually arrives in, and the shape is inferred from the arguments you name:
Each row is an edge active over [start, end). Used when
the data carry an end time or a duration.
Each row is an instantaneous event with a time and no duration – a message, a click, a citation.
Forum, chat or email data. An edge is treated as active
from its own post until the last post in the same thread, following
Saqr and Nouri (2020). Name the thread argument to select this.
Two-mode attendance data. Actors sharing a group become
connected for the span of that group. Name actor and group.
Every other column of data is kept as a tie attribute: it appears in
as.data.frame() and can be selected on with induce_subgraph(ties = ).
The exceptions are the canonical spell fields themselves – duration,
weight, session, thread, onset_censored and terminus_censored –
which are dropped even when they were never named as arguments, because the
spell table owns those names. A non-atomic column raises
dynet_bad_tie_attribute, and a factor is carried as character.
Co-presence logs keep none, because their rows are memberships rather than
ties.
Column names are resolved case-insensitively from a table of aliases, so
Sender/Receiver, source/target and onset/terminus are all
understood without being spelled out. Times may be numeric, Date,
POSIXct or character date-time strings; character and date-time input is
converted to elapsed time since the first event in a readable unit.
Vertices are addressed by name everywhere in this package. Integer vertex indices are used internally for speed but are never part of any result.
Explicit observation bounds are administrative measurement limits, not a
destructive filter. A positive spell [s,e) contributes the half-open
intersection [max(s,L),min(e,U)) when it has positive duration, while a
genuine instantaneous event is retained at either L or U. Original
endpoints remain the only formation and dissolution events, censoring is
never inferred from equality with a limit, and temporal paths must both
start and finish inside the declared interval.
Vertex activity is a separate declaration. A vertex with at least one row
in vertex_spells is eligible only on the union of those half-open positive
spells and exact points; a vertex with no row remains eligible at all times.
Snapshot measurements independently union eligible vertices and active
edges over each positive window and then induce on eligible endpoints;
point snapshots evaluate both at the exact time. Explicit vertex censor
flags describe raw outer-boundary state and are never inferred from
observation limits or used to alter eligibility.
dynet(
data,
from = NULL,
to = NULL,
start = NULL,
end = NULL,
duration = NULL,
time = NULL,
thread = NULL,
actor = NULL,
group = NULL,
session = NULL,
weight = NULL,
nodes = NULL,
groups = NULL,
format = c("auto", "interval", "contact", "threaded", "copresence"),
thread_clock = c("absolute", "relative"),
directed = TRUE,
interval = 1,
time_unit = "auto",
observation_start = NULL,
observation_end = NULL,
observation_spells = NULL,
loops = FALSE,
min_thread_posts = 1L,
onset_censored = NULL,
terminus_censored = NULL,
vertex_spells = NULL
)
data |
Data frame holding one relational event per row. |
from, to |
Column names for the source and target vertex. Auto-detected
from |
start, end |
Column names for the start and end of an edge spell.
Auto-detected from |
duration |
Column name for a spell duration, used in place of |
time |
Column name for an event time, used in place of |
thread |
Column name identifying a conversation thread. Naming it selects the threaded format. |
actor, group |
Column names for the actor and the shared group. Naming both selects the co-presence format. |
session |
Column name for a session or period grouping. Sessions act as walls that time-respecting paths do not cross. |
weight |
Column name for event multiplicity. |
nodes |
Optional data frame of vertex attributes. The vertex key is
auto-detected ( |
groups |
Name of a column in |
format |
One of |
thread_clock |
For a threaded log, |
directed |
Whether edges are directed, |
interval |
Width of one time bin, in the network's time unit. Defaults
to |
time_unit |
Unit for converting |
observation_start, observation_end |
Optional bounds of the continuous
observation interval. Supply numeric values in the network's internal
time scale, or |
observation_spells |
Optional data frame with exactly two columns,
|
loops |
Whether to keep self-loops. |
min_thread_posts |
For a threaded log, the smallest number of posts a
thread must hold, after self-loops have been dropped, for its posts to
enter the network. The default |
onset_censored, terminus_censored |
Optional logical column names for explicit raw interval-boundary censor state. These selectors are available only for interval input, are never auto-detected, and may not flag a zero-duration point. |
vertex_spells |
Optional tidy vertex-activity table: one row per
period in which a vertex is present, with a node column ( |
An object of class c("dynet", "netobject", "cograph_network").
It is a cograph network, so cograph::splot() draws it directly and
every cograph rendering argument applies. Use as.data.frame() for the
tidy spell table, as.data.frame(x, what = "nodes") for the vertex
table, as.data.frame(x, what = "network") for the aggregate edge list,
summary() for the description and plot() for a picture. Nothing in
this package requires you to reach into the object.
Saqr, M., & Nouri, J. (2020). High resolution temporal network analysis to understand and improve collaborative learning. Proceedings of the Tenth International Conference on Learning Analytics & Knowledge, 314-319.
Holme, P., & Saramaki, J. (2012). Temporal networks. Physics Reports, 519(3), 97-125.
Butts, C. T. (2008). network: a package for managing relational data in R. Journal of Statistical Software, 24(2), 1-36.
# An interval log: each row carries its own start and end
dynet(school_contacts)
# A threaded log: edge stays active until its thread falls silent
dynet(forum_posts, thread = "thread")
# A co-presence log: actors sharing a group become connected
dynet(seminar_attendance, actor = "student", group = "seminar")
# Declare observation time without rewriting the source spell.
bounded <- dynet(data.frame(
from = "A", to = "B", start = -2, end = 8
), observation_start = 0, observation_end = 5)
as.data.frame(bounded)
# Declare changing vertex eligibility without altering edge spells.
scheduled <- dynet(data.frame(
from = "A", to = "B", start = 0, end = 10
), vertex_spells = data.frame(
node = c("A", "A"), start = c(0, 7), end = c(4, 10)
))
as.data.frame(scheduled, what = "vertex_spells")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.