read_xmile {readsdr} | R Documentation |
Read an XMILE file into R
Description
read_xmile
returns a list for constructing deSolve functions and graphs
Usage
read_xmile(filepath, stock_list = NULL, const_list = NULL, graph = FALSE)
Arguments
filepath |
A string that indicates a path to a file with extension .stmx or .xmile. Vensim files (.mdl) are not xmile files. They must be exported from Vensim with extension .xmile |
stock_list |
A list in which each element's name is the name of the stock to override and the element's value correspond to the new init value. |
const_list |
A list in which each element's name is the name of the constant to override and the element's value correspond to the new value. |
graph |
A boolean parameter that indicates whether |
Details
This function extracts the xml from the file specified via filepath
to generate a list of objects. Such a list contains a summary of the model,
the inputs for simulating through deSolve, and the inputs for
creating a igraph object.
Value
This function returns a list with three elements. The first element, description, is a list that contains the simulation parameters, and the names and equations (including graphical functions) for each stock or level, variable and constant. The second element, deSolve_components, is a list that contains initial values, constants and the function for simulating via deSolve. The third element (optional), igraph contains the data.frames for creating a graph with igraph.
Examples
path <- system.file("models", "SIR.stmx", package = "readsdr")
read_xmile(path)