as.data.frame.netdx: Extract Timed Edgelists for netdx Objects

View source: R/as.data.frame.R

as.data.frame.netdxR Documentation

Extract Timed Edgelists for netdx Objects

Description

This function extracts timed edgelists for objects of class netdx into a data frame using the generic as.data.frame function.

Usage

## S3 method for class 'netdx'
as.data.frame(x, row.names = NULL, optional = FALSE, sim, ...)

Arguments

x

An EpiModel object of class netdx.

row.names

See as.data.frame.default.

optional

See as.data.frame.default.

sim

The simulation number to output. If not specified, then data from all simulations will be output.

...

See as.data.frame.default.

Value

A data frame containing the data from x.

Examples

# Initialize and parameterize the network model
nw <- network_initialize(n = 100)
formation <- ~edges
target.stats <- 50
coef.diss <- dissolution_coefs(dissolution = ~offset(edges), duration = 20)

# Model estimation
est <- netest(nw, formation, target.stats, coef.diss, verbose = FALSE)

# Simulate the network with netdx
dx <- netdx(est, nsims = 3, nsteps = 10, keep.tedgelist = TRUE,
            verbose = FALSE)

# Extract data from the first simulation
as.data.frame(dx, sim = 1)

# Extract data from all simulations
as.data.frame(dx)


EpiModel documentation built on Oct. 12, 2024, 1:06 a.m.