Interface to the 'Pharmpy' 'Pharmacometrics' Library

Interface to the 'Pharmpy' 'pharmacometrics' library. The 'Reticulate' package is used to interface Python from R.


CRAN status check

pharmr is an R wrapper to Pharmpy: an open-source software package for pharmacometric modeling. It provides an R interface to all functions found in the modeling and tools modules (documented here). The documentation for each function is also available via the help-function (or ?).

For comprehensive information and documentation, see: https://pharmpy.github.io

Installation and setup

Install from CRAN

The latest stable version of pharmr is available via CRAN, and can be installed via:

install.packages("pharmr")

After installing pharmr, Pharmpy needs to be set up:

pharmr::install_pharmpy()

For a more comprehensive description of the process of setting up, see the following guide.

Install from GitHub

It is also possible to install the development version of pharmr from GitHub, with the following command:

remotes::install_github("pharmpy/pharmr", ref="main")

Pharmpy can then be installed:

pharmr::install_pharmpy()

Using pharmr

>>> library(pharmr)
>>> model <- load_example_model("pheno")
>>> model$parameters
            value  lower upper    fix
POP_CL   0.004693   0.00     ∞  False
POP_VC   1.009160   0.00     ∞  False
COVAPGR  0.100000  -0.99     ∞  False
IIV_CL   0.030963   0.00     ∞  False
IIV_VC   0.031128   0.00     ∞  False
SIGMA    0.013086   0.00     ∞  False
>>> res <- load_example_modelfit_results("pheno")
>>> res$parameter_estimates
    POP_CL     POP_VC    COVAPGR     IIV_CL     IIV_VC      SIGMA 
0.00469555 0.98425800 0.15892000 0.02935080 0.02790600 0.01324100 
>>>

A simple example of reading a model, performing a simple transformation, and running the model in NONMEM. Note that you need NONMEM installed to be able to fit the model, see the following guide on how to set up the config file.

model <- load_example_model('pheno') |>
  add_peripheral_compartment()
 
res <- fit(model)

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("pharmr")

2.2.0 by Rikard Nordgren, a month ago


https://github.com/pharmpy/pharmr


Report a bug at https://github.com/pharmpy/pharmr/issues


Browse source code at https://github.com/cran/pharmr


Authors: Rikard Nordgren [aut, cre, cph] , Stella Belin [aut, cph] , Mats O. Karlsson [sad] , Andrew C. Hooker [sad] , Xiaomei Chen [sad] , Sebastian Ueckert [sad] (ORCID: , Simon Buatois [rev] , João A. Abrantes [rev] , Emilie Schindler [rev] , F. Hoffmann-La Roche Ltd. [fnd] , Bayer AG [fnd]


Documentation:   PDF Manual  


LGPL (>= 3) license


Imports htmltools, reticulate, cli, utils

Suggests testthat, here, knitr

System requirements: Python (>= 3.12.0)


See at CRAN