as.data.frame.sdbuildR_sim: Create data frame of simulation results

View source: R/build_xmile.R

as.data.frame.sdbuildR_simR Documentation

Create data frame of simulation results

Description

Convert simulation results to a data.frame.

Usage

## S3 method for class 'sdbuildR_sim'
as.data.frame(x, row.names = NULL, optional = FALSE, direction = "long", ...)

Arguments

x

Output of simulate().

row.names

NULL or a character vector giving the row names for the data frame. Missing values are not allowed.

optional

Ignored parameter.

direction

Format of data frame, either "long" (default) or "wide".

...

Optional parameters

Value

A data.frame with simulation results. For direction = "long" (default), the data frame has three columns: time, variable, and value. For direction = "wide", the data frame has columns time followed by one column per variable.

See Also

simulate(), xmile()

Examples

sfm <- xmile("SIR")
sim <- simulate(sfm)
df <- as.data.frame(sim)
head(df)

# Get results in wide format
df_wide <- as.data.frame(sim, direction = "wide")
head(df_wide)


sdbuildR documentation built on Nov. 19, 2025, 5:07 p.m.