Create a metamodel file from an NlmePmlModel
create_metamodel_from_model.RdCreates (or overwrites) a textual metamodel file (e.g. .mmdl) from a
supplied NlmePmlModel object. This is the inverse of read_mmdl().
Usage
create_metamodel_from_model(
model,
metamodelFile,
datafile,
author = "",
engineParams = NULL,
tableParams = NULL,
absolutePaths = FALSE
)Arguments
- model
An NlmePmlModel object.
- metamodelFile
Output metamodel file path to create/overwrite.
- datafile
Input data file path to write into the
## DATAblock.Optional author string to write into the metamodel.
- engineParams
Optional NlmeEngineExtraParams object created by
engineParams()to serialize into the## ESTARGSblock. Only arguments that differ fromengineParams()defaults for this model (and estimation method) are written.- tableParams
Optional table definition(s) created by
tableParams()(i.e., NlmeTableDef and/or NlmeSimTableDef, or a list of them) to serialize into the## TABLESblock.- absolutePaths
Logical; controls how
datafileis written into the## DATAblock.FALSE(default) writes a path relative to the metamodel directory (e.g../data.csv), keeping the resulting metamodel portable across machines.TRUEwrites a normalized absolute path, useful when the dataset lives outside the metamodel tree (shared drive, central data location). When relative resolution is not possible (e.g. different Windows drive), the function warns and falls back to an absolute path.
Examples
if (FALSE) { # \dontrun{
tmp_data <- tempfile(fileext = ".csv")
write.csv(Certara.RsNLME::pkData, tmp_data, row.names = FALSE)
m <- Certara.RsNLME::pkmodel(data = Certara.RsNLME::pkData, workingDir = tempdir())
ep <- Certara.RsNLME::engineParams(m, method = "FOCE-ELS", numIterations = 200)
out_mmdl <- file.path(tempdir(), "example.mmdl")
Certara.RsNLME::create_metamodel_from_model(m, out_mmdl, datafile = tmp_data, engineParams = ep)
} # }