Skip to contents

Imports a metamodel file into an NlmePmlModel object (textual) ready for execution. Canonical user-facing reader; supersedes the legacy create_model_from_metamodel().

Usage

read_mmdl(file, directoryToRun = NULL)

Arguments

file

Path to a metamodel file (typically .mmdl).

directoryToRun

Optional working directory for the created model. If NULL (default), a subfolder named after the metamodel is used.

Value

A list with elements:

  • model: an NlmePmlModel

  • params: engine parameters (NlmeEngineExtraParams or a list, depending on the metamodel content) for any arguments provided in ## ESTARGS blocks.

Details

If the dataset referenced by the ## DATA block is missing from disk, read_mmdl() emits a warning containing the resolved path and returns the model with @inputData = NULL. Column mappings declared in the ## MAP block are still applied. Attach the dataset later via initColMapping(model) <- yourData to re-run data-dependent validation. The ## PRE script (if any) is skipped in this case because it requires the data file.

The dataset may be a plain delimited file or one written in the NLME engine's own layout (a ##name1,name2 header line, an optional #@unit1,unit2 units row, and # comment lines) such as the data1.txt found in a run directory. Units are carried on the returned data as its Units attribute so they are re-emitted when the model is run.