Skip to contents

For each row k in a single conversation's code matrix, accumulates connections over a back/forward window.

Usage

accumulate_stanza(
  codes,
  window_back = 1L,
  window_forward = 0L,
  binary = TRUE,
  ordered = FALSE
)

Arguments

codes

Numeric matrix (rows = lines, cols = codes) for ONE conversation

window_back

Number of prior lines in window (default 1); use .Machine$integer.max for Inf

window_forward

Number of subsequent lines (default 0; ignored when ordered = TRUE)

binary

If TRUE, binarise non-zero connection counts

ordered

If TRUE, return directed n² output; FALSE (default) returns upper-tri

Value

Undirected: (n_rows × choose_two(n_codes)); directed: (n_rows × n_codes²)

Details

Undirected (ordered = FALSE, default): upper-triangle co-occurrences with back/forward-reference corrections. Returns n_rows × choose_two(n_codes).

Directed (ordered = TRUE): focal row k as response, sum of prior window rows as ground, using the directed connection formula. window_forward is ignored. Returns n_rows × n_codes².