Learn R Programming

rodeo (version 0.9.2)

buildFromText: Build a model from the contents of delimited textfiles

Description

The function builds a rodeo-based model by importing all declarations and equations from tables stored as delimited text.

Usage

buildFromText(
  declarations,
  equations,
  sep = "\t",
  dim = 1,
  set_defaults = TRUE,
  fortran = FALSE,
  sources = NULL,
  ...
)

Value

An object of class rodeo.

Arguments

declarations

File path of a delimited text file holding the declaration of state variables, parameters, and functions. See below for details about the expected file contents.

equations

File path of a delimited text file holding mathematical expressions of process rates and stoichiometric factors forming the right hand sides of a system of simultaneous ODE. See below for details about the expected file contents.

sep

The column delimiter used in the input text files.

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.

set_defaults

If TRUE, parameters and initial values will be set according to the contents of the 'default' columns of the workbook sheets 'declarations', respectively. If FALSE, values must be set explicitly using the class methods setPars and setVars. An attempt to use set_defaults=TRUE when dim != 1 will be ignored (with a warning).

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.table.

Author

David Kneis david.kneis@tu-dresden.de

See Also

buildFromWorkbook provides similar functionality

Examples

Run this code

# Build and run a SEIR type epidemic model
decl <- system.file("models/SEIR_declarations.txt", package="rodeo")
eqns <- system.file("models/SEIR_equations.txt", package="rodeo")
m <- buildFromText(decl, eqns)
x <- m$dynamics(times=0:30, fortran=FALSE)
print(head(x))

Run the code above in your browser using DataLab