Package 'nonmem2mrgsolve'

Title: Automated NONMEM to mrgsolve Translation
Description: This package is intended to streamline the modeling and simulation process for PK and PK-PD applications by translating NONMEM models to mrgsolve syntax. It currently does not encompass all NONMEM use cases, and as such modifications to the output mrgsolve code may be neccessary. There is no guarantee to the accuracy of the translation. It remains the responsibility of the user to perform validation of the resulting mrgsolve code.
Authors: Andrew Santulli
Maintainer: Andrew Santulli <[email protected]>
License: GPL (>=2)
Version: 1.2.0
Built: 2026-10-17 05:11:07 UTC
Source: https://github.com/Andy00000000000/nonmem2mrgsolve

Help Index


Load NONMEM ctl (or mod) file into R

Description

Loads the NONMEM ctl (or mod) file into R for translation to mrgsolve format.

Usage

load_ctl(filename = NULL, dir = "")

Arguments

filename

String of the NONMEM model name without the .ctl (or .mod) extension

dir

String of the directory path to the NONMEM run files

Value

R dataframe of the NONMEM ctl (or mod) file

Examples

# load_ctl(filename = "nonmem-model", dir = "path/to/directory/")

Load NONMEM ext file into R

Description

Loads the NONMEM ext file into R for capture of the final estimates.

Usage

load_ext(filename = NULL, dir = "", sigdig = -1, use.cnv = F)

Arguments

filename

String of the NONMEM model name without the .ext extension

dir

String of the directory path to the NONMEM run files

sigdig

Numeric of the number of significant digits to round non-fixed thetas and etas to; -1 for no rounding

use.cnv

Logical for whether to use the NONMEM cnv file for final parameter estimates instead of the ext file (T or F)

Value

R list of the NONMEM final OFV, parameter estimates, and IIV magnitudes

Examples

load_ext(filename = "nonmem-model", dir = "path/to/directory/")

Automated NONMEM to mrgsolve Translation

Description

Translates a NONMEM model into mrgsolve syntax using the NONMEM ctl and ext (or cnv) files.

Usage

nonmem2mrgsolve(
  filename = NULL,
  dir = NULL,
  sigdig = NULL,
  write = T,
  return.orig = F,
  out.filename = NULL,
  use.cnv = F
)

Arguments

filename

String of the NONMEM model name with or without the .ctl (or .mod) extension

dir

String of the directory path to the NONMEM files (if not already given in the filename input; or if the working directory was not already set)

sigdig

Numeric of the number of significant digits to round non-fixed thetas and etas to; default NULL for no rounding

write

Logical for whether to write the mrgsolve code to an R file (T or F)

return.orig

Logical for whether to output the original NONMEM ctl and ext files (T or F)

out.filename

String of the name for the mrgsolve output file without the .R extension

use.cnv

Logical for whether to use the NONMEM cnv file for final parameter estimates instead of the ext file (T or F)

Value

R dataframe of the mrgsolve code

Examples

# setwd("path/to/directory")
# nonmem2mrgsolve::nonmem2mrgsolve(filename = "nonmem-model.ctl")

Write the mrgsolve code to an R file

Description

Writes the mrgsolve code, translated from the input NONMEM run, to an R file.

Usage

writemrgsolve(mrg_code = NULL, filename = "mrgsolve_code0", dir = NULL)

Arguments

mrg_code

Dataframe of the NONMEM model translated into mrgsolve code

filename

String of the name for the mrgsolve output file without the .R extension

dir

String of the directory path to the NONMEM run files

Value

R file of the mrgsolve code

Examples

# writemrgsolve()