% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/stockflow.R
\name{as.data.frame.stockflow}
\alias{as.data.frame.stockflow}
\title{Convert stock-and-flow model to data frame}
\usage{
\method{as.data.frame}{stockflow}(
  x,
  row.names = NULL,
  optional = FALSE,
  vars = NULL,
  type = NULL,
  properties = NULL,
  ...
)
}
\arguments{
\item{x}{A stock-and-flow model object of class \code{\link{stockflow}}.}

\item{row.names}{\code{NULL} or a character vector giving the row names for the data frame. Missing values are not allowed.}

\item{optional}{Ignored parameter.}

\item{vars}{Variable names to retain in the data frame. Defaults to \code{NULL} to include all variables.}

\item{type}{Variable types to retain in the data frame. Must be one or more of 'stock', 'flow', 'constant', 'aux', 'lookup', or 'func'. Defaults to \code{NULL} to include all types.}

\item{properties}{Variable properties to retain in the data frame. Defaults to \code{NULL} to include all properties.}

\item{...}{Optional arguments}
}
\value{
A data.frame with one row per model component.
Common columns include \code{type} (component type), \code{name} (variable name),
\code{eqn} (equation), and \code{label} (descriptive label). Additional columns may include \code{to}, \code{from},
\code{non_negative}, and others depending on variable types. The exact columns returned
depend on the \code{type} and \code{properties} arguments. Returns an empty data.frame
if no components match the filters.
}
\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.
}
\examples{
as.data.frame(stockflow("sir"))

# Only show stocks
as.data.frame(stockflow("sir"), type = "stock")

# Only show specific variables
as.data.frame(stockflow("sir"), vars = c("susceptible", "infected"))

# Only show equation and label
as.data.frame(stockflow("sir"), properties = c("eqn", "label"))

}
\concept{build}
