Learn R Programming

EpiModel (version 2.5.0)

as.data.frame.netdx: 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 netdx
as.data.frame(x, row.names = NULL, optional = FALSE, sim, ...)

Value

A data frame containing the data from x.

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.

Examples

Run this code
# 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)

Run the code above in your browser using DataLab