R: Methods for working with the model compartment list

init {mrgsolve} | R Documentation

## Methods for working with the model compartment list

### Description

Calling `init` with the model object as the first argument will return the model initial conditions as a `numericlist` object. See `numericlist` for methods to deal with `cmt_list` objects.

### Usage

    init(.x, ...)

    ## S4 method for signature 'mrgmod'
    init(.x, .y = list(), ..., .pat = "*")

    ## S4 method for signature 'mrgsims'
    init(.x, ...)

    ## S4 method for signature 'missing'
    init(.x, ...)

    ## S4 method for signature 'list'
    init(.x, ...)

    ## S4 method for signature 'ANY'
    init(.x, ...)

### Arguments

`.x` | the model object
`...` | passed along
`.y` | list to be merged into parameter list
`.pat` | a regular expression (character) to be applied as a filter when printing compartments to the screen

### Details

Can be used to either get a compartment list object from a `mrgmod` model object or to update the compartment initial conditions in a model object. For both uses, the return value is a `cmt_list` object. For the former use, `init` is usually called to print the compartment initial conditions to the screen, but the `cmt_list` object can also be coerced to a list or numeric R object.

### Value

an object of class `cmt_list` (see `numericlist`)

### Examples

    ## example("init")
    mod <- mrgsolve::house()

    init(mod)
    init(mod, .pat="^C") ## may be useful for large models

    class(init(mod))

    init(mod)$CENT

    as.list(init(mod))
    as.data.frame(init(mod))

[Package mrgsolve version 1.0.0 Index]