Learn R Programming

rodeo (version 0.8.2)

buildFromWorkbook: Build a model from the contents of a workbook

Description

The function builds a rodeo-based model by importing all declarations and equations from a workbook established with common spreadsheet software.

Usage

buildFromWorkbook(workbook, dim = 1, fortran = FALSE, sources = NULL, ...)

Value

An object of class rodeo.

Arguments

workbook

File path of the workbook. The file type is guessed from the extension which must be '.xlsx' or '.ods'. See below for the mandatory worksheets that must be present in the workbook.

dim

The number of spatial compartments, possibly in multiple dimensions. For single-box models without spatial resolution, use dim=1 (default). For a one-dimensional model with 10 compartments use, e.g., dim=10. See the dim argument of the method initialize for further details.

fortran

Controls the language of code generation. The default (FALSE) produces R code. Use TRUE if you want to use compiled Fortran code for better performance. In the latter case, you will need a Fortran compiler which is accessible by R.

sources

Only relevant if fortran=TRUE. The argument allows the name(s) of additional source file(s) to be provided for processing by the Fortran compiler. In any case, the Fortran code in sources must implement a module with the fixed name 'functions'. This module must contain all user-defined functions referenced in any process rate expressions or any cell of the stoichiometry matrix.

...

Optional arguments passed to read_excel or read_ods, respectively.

Author

David Kneis david.kneis@tu-dresden.de

Examples

Run this code

# Build a SEIR type epidemic model
m <- buildFromWorkbook(
  system.file("models/SEIR.xlsx", package="rodeo")
)
m$setPars(setNames(m$getParsTable()$default,
  m$getParsTable()$name))
m$setVars(setNames(m$getVarsTable()$default,
  m$getVarsTable()$name))
x <- m$dynamics(times=0:30, fortran=FALSE)
print(head(x))

Run the code above in your browser using DataLab