as.data.frame.simulab_tna: Tidy tables of a simulated transition network

View source: R/tna.R

as.data.frame.simulab_tnaR Documentation

Tidy tables of a simulated transition network

Description

Tidy tables of a simulated transition network

Usage

## S3 method for class 'simulab_tna'
as.data.frame(x, row.names = NULL, optional = FALSE, what = "edges", ...)

Arguments

x

A simulab_tna result of simulate_tna().

row.names, optional

Ignored; present for the generic.

what

Table to return: "edges" (the default, the fitted network), "transitions", "initial_probabilities", "sequences", "wide" or "model_info".

...

Ignored.

Value

A base data.frame. "edges" has one row per edge with columns from, to and weight; "transitions" one row per edge with columns from, to and probability; "initial_probabilities" one row per state with columns state and probability; "sequences" one row per sequence and position with columns id, period and state.

Examples

if (requireNamespace("tna", quietly = TRUE)) {
  network <- simulate_tna(n = 30, n_states = 3, seed = 1)
  as.data.frame(network)
  as.data.frame(network, what = "transitions")
}

simulab documentation built on Oct. 15, 2026, 5:08 p.m.