Learn R Programming

mrgsolve (version 1.5.1)

mwrite_yaml: Write model code to yaml format

Description

Model code is written to a readable, transport format. This transport format can be useful for (1) breaking connection to NONMEM modeling outputs that are imported by $NMXML or $NMEXT and (2) saving model updates (e.g., an updated parameter list). Models can be read back using mread_yaml() or converted to mrgsolve cpp format with yaml_to_cpp().

Usage

mwrite_yaml(x, file, digits = 8)

Value

A list containing data that was written out to the yaml file, with added item file, is returned invisibly.

Arguments

x

a model object.

file

output file name; if non-character (e.g., NULL), no output will be written to file.

digits

precision to use when writing outputs.

Details

Parameters and omega and sigma matrices that were imported via $NMXML or $NMEXT will be written into the yaml file and the NONMEM import blocks will be dropped. This allows the user to load a model based on a NONMEM run without having a connection to that output (e.g., root.xml or root.ext). Given that the connection to the NONMEM modeling outputs is broken when writing to yaml, any update to the NONMEM run will only be propagated to the yaml file when mwrite_yaml() is run again.

The yaml file does not currently have the ability to track other external dependencies, such as user-defined header files or other code that might be sourced in by the user when the model is loaded via mread(). NONMEM xml and ext files imported by $NMXML or $NMEXT are the only external dependencies that are accounted for in the yaml transport file.

See Also

mread_yaml(), yaml_to_cpp()

Examples

Run this code
mod <- house()

temp1 <- tempfile(fileext = ".yaml")

x <- mwrite_yaml(mod, temp1)

readLines(temp1)

Run the code above in your browser using DataLab