as.data.frame.stockflow: Convert stock-and-flow model to data frame
Description
Create a data frame with properties of all model variables and functions. Specify the variable types, variable names, and/or properties to get a subset of the data frame.
Usage
# S3 method for stockflow
as.data.frame(
x,
row.names = NULL,
optional = FALSE,
name = NULL,
type = NULL,
properties = NULL,
...
)
Value
A data.frame with one row per model component.
Common columns include type (component type), name (variable name),
eqn (equation), and label (descriptive label). Additional columns may include to, from,
non_negative, and others depending on variable types. The exact columns returned
depend on the type and properties arguments. Returns an empty data.frame
if no components match the filters.
Arguments
x
A stock-and-flow model object of class stockflow.
row.names
NULL or a character vector giving the row names for the data frame. Missing values are not allowed.
optional
Ignored parameter.
name
Variable names to retain in the data frame. Defaults to NULL to include all variables.
type
Variable types to retain in the data frame. Must be one or more of 'stock', 'flow', 'constant', 'aux', 'gf', or 'func'. Defaults to NULL to include all types.
properties
Variable properties to retain in the data frame. Defaults to NULL to include all properties.
as.data.frame(stockflow("SIR"))
# Only show stocksas.data.frame(stockflow("SIR"), type = "stock")
# Only show equation and labelas.data.frame(stockflow("SIR"), properties = c("eqn", "label"))