as.data.frame.dynet_metric: Tidy data frame of a temporal measure

View source: R/result.R

as.data.frame.dynet_metricR Documentation

Tidy data frame of a temporal measure

Description

Tidy data frame of a temporal measure

Usage

## S3 method for class 'dynet_metric'
as.data.frame(
  x,
  row.names = NULL,
  optional = FALSE,
  layout = c("long", "wide"),
  what = c("values", "diagnostics"),
  top = NULL,
  ...
)

Arguments

x

A dynet_metric produced by any measurement verb.

row.names

Ignored; present for compatibility with the generic.

optional

Ignored; present for compatibility with the generic.

layout

"long" gives one row per observation, which is the default and the shape every other verb expects. "wide" spreads time across columns, giving one row per vertex (or per measure for graph-level quantities), which is convenient for exporting a table. A measure with no time axis, such as reachability, is spread by measure instead: one row per vertex with one column per measure.

what

"values", the default, gives the measured values. "diagnostics" gives the record a prestige computation keeps when it cannot produce a value, which is what the accompanying warning refers to: one row per reporting block that was undefined, infeasible or nonconverged, with session, time, stage, status and reason, the solver's iterations and residual, the ⁠balance_*⁠ family for the row-column scaling step, and spectral_radius, eigenspace_dimension and eigen_residual for the eigen step. A result with nothing to report gives a zero-row frame of those same columns rather than NULL.

top

Keep only the top vertices with the largest mean value, and order the result from largest to smallest. A single positive number; NULL, the default, keeps every row in the measure's own order. It selects vertices, so it applies to what = "values" on a measure that has a node column; anything else raises a dynet_bad_input error.

...

Ignored.

Value

A plain data.frame. Long layout carries measure and value with one row per observation, alongside whichever columns say what was measured: session when the network has sessions, time for anything measured on a grid of bins, node for a vertex-level quantity, from and to for a pair-level one, raw_spell for per-spell edge durations and vertex_spell with implicit for per-spell vertex durations from durations(), and from_group and to_group for mixing(). A graph-level series carries time, measure and value alone.

Wide layout puts the identifying columns first and spreads what varies across the rest. A measure taken on a grid of bins spreads time: one column per bin, named t followed by the bin's time, leaving one row per vertex and measure. A measure with no time axis, such as reachability, spreads the measures instead: one column per measure, leaving one row per vertex. A measure with no time axis and only one measure is already wide and comes back unchanged.

Examples

dn <- dynet(school_contacts)
degree <- centrality_series(dn, measure = "degree")
as.data.frame(degree)
as.data.frame(degree, layout = "wide")
as.data.frame(degree, top = 5)
as.data.frame(degree, what = "diagnostics")


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