The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Package {rxode2mrgsolvebridge}


Type: Package
Title: Convert Models Between 'rxode2' and 'mrgsolve'
Version: 0.1.0
Description: Provides an intermediate representation and file-oriented helpers for converting pharmacometric model code between 'rxode2' and 'mrgsolve'. The conversion uses a package-specific intermediate representation described by Hammami F (2026) "rxode2-mrgsolve-bridge" https://gitlab.com/fiha1/rxode2-mrgsolve-bridge.
URL: https://gitlab.com/fiha1/rxode2-mrgsolve-bridge
BugReports: https://gitlab.com/fiha1/rxode2-mrgsolve-bridge/-/issues
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.2
Imports: stats
Suggests: mrgsolve, rxode2, testthat (≥ 3.0.0), withr
Config/testthat/edition: 3
NeedsCompilation: no
Packaged: 2026-05-13 07:30:36 UTC; fiha
Author: Firas Hammami [aut, cre]
Maintainer: Firas Hammami <fiha@genmab.com>
Repository: CRAN
Date/Publication: 2026-05-18 18:40:07 UTC

Convert models between rxode2 and mrgsolve

Description

Provides a shared intermediate representation and file-oriented helpers for converting model code between rxode2 and mrgsolve.

Usage

parse_rxode2_model(rx_mod, theta, model_name = NULL, description = NULL)

parse_mrgsolve_model(model_code, model_name = NULL, description = NULL)

parse_mrgsolve_file(path, model_name = NULL, description = NULL)

ir_to_mrgsolve(ir, tab = "  ")

ir_to_rxode2(ir, model_name = NULL, include_observables_block = FALSE)

export_mrgsolve_model(ir, file, overwrite = TRUE)

export_rxode2_files(
  ir,
  out_dir = NULL,
  model_name = NULL,
  theta_name = "theta",
  model_file = "model_rxode2.R",
  theta_file = "theta.R",
  overwrite = TRUE
)

convert_rxode2_to_mrgsolve(
  rx_model,
  theta_file,
  theta_name = "theta",
  output_file = NULL,
  output_basename = NULL,
  out_dir = NULL,
  model_name = NULL,
  overwrite = TRUE
)

convert_mrgsolve_to_rxode2(
  mrgsolve_file,
  output_basename = NULL,
  out_dir = NULL,
  rx_model_name = NULL,
  theta_name = "theta",
  model_file = NULL,
  theta_file = NULL,
  overwrite = TRUE
)

Arguments

rx_mod, rx_model

An rxode2 model object, rxode2 model code string, or, for rx_model, a path to an R file containing a named model object.

theta

Named numeric vector of parameter values.

theta_file

R file containing a named numeric theta vector.

theta_name

Name of the theta vector object to read or write.

model_code

Character string containing mrgsolve model code.

path, mrgsolve_file

Path to an mrgsolve model file.

ir

Model intermediate representation list.

file, output_file

Output mrgsolve file path.

out_dir

Output directory. Must be supplied explicitly by writing helpers; use tempdir() or tempfile()-based directories in examples and tests.

model_name, rx_model_name

Model name for metadata, lookup, or generated rxode2 object names.

model_file

Output file name for the rxode2 model file.

output_basename

Basename used to derive default output file names.

description

Optional model description.

tab

Indentation used when rendering mrgsolve code.

include_observables_block

Whether to render an explicit rxode2 observables block.

overwrite

Whether existing output files may be overwritten.

Details

Default wrapper output names are derived from the input basename: <input>_mrgsolve.cpp for rxode2 to mrgsolve, and <input>_rxode.R plus <input>_rxode_theta.R for mrgsolve to rxode2. The wrappers only use these generated names after the caller supplies an explicit output directory, or after the caller supplies a complete output file path.

Value

Parsing functions return an intermediate representation list. Rendering functions return character code or code/theta lists. Export and conversion functions return output paths invisibly.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.