R: Import model estimates from a NONMEM xml file

nmxml {mrgsolve} | R Documentation

## Import model estimates from a NONMEM xml file

### Description

Import model estimates from a NONMEM xml file

### Usage

    nmxml(
      run = numeric(0),
      project = character(0),
      file = character(0),
      path = character(0),
      root = c("working", "cppfile"),
      theta = TRUE,
      omega = TRUE,
      sigma = TRUE,
      olabels = NULL,
      slabels = NULL,
      oprefix = "",
      sprefix = "",
      tname = "THETA",
      oname = "...",
      sname = "...",
      index = "last",
      xpath = ".//nm:estimation",
      env = NULL
    )

### Arguments

`run` | run number
`project` | project directory
`file` | deprecated; use `path` instead
`path` | the complete path to the `run.xml` file
`root` | the directory that 'path' and 'project' are relative to; this is currently limited to the 'working' directory or 'cppdir', the directory where the model file is located
`theta` | logical; if TRUE, the `$THETA` vector is returned
`omega` | logical; if TRUE, the `$OMEGA` matrix is returned
`sigma` | logical; if TRUE, the `$SIGMA` matrix is returned
`olabels` | labels for `$OMEGA`
`slabels` | labels for `$SIGMA`
`oprefix` | prefix for `$OMEGA` labels
`sprefix` | prefix for `$SIGMA` labels
`tname` | name for `$THETA`
`oname` | name for `$OMEGA`
`sname` | name for `$SIGMA`
`index` | the estimation number to return; "last" will return the last estimation results; otherwise, pass an integer indicating which estimation results to return
`xpath` | xml path containing run results; if the default doesn't work, consider using `.//estimation` as an alternative; see details
`env` | internal

### Details

If `run` and `project` are supplied, the .xml file is assumed to be located in `run.xml`, in directory `run` off the `project` directory. If `file` is supplied, `run` and `project` arguments are ignored.

This function requires that the `xml2` package be installed and loadable. If `requireNamespace("xml2")` fails, an error will be generated.

`nmxml` usually expects to find run results in the xpath called `.//nm:estimation`. Occasionally, the run results are not stored in this namespace but no namespaces are found in the xml file. In this case, the user can specify the xpath containing run results. Consider trying `.//estimation` as an alternative if the default fails.

### Value

A list with theta, omega and sigma elements, depending on what was requested

### See Also

nmext

### Examples

    if(requireNamespace("xml2")) {
      proj <- system.file("nonmem", package = "mrgsolve")
      mrgsolve:::nmxml(run = 1005, project = proj)
    }

[Package mrgsolve version 1.0.0 Index]