In this page, we explain the installation procedure of the R-package that allows to run Monolix from R.
Prerequisites
R version 3.0.0 or higher is required to use lixoftConnectors.
The lixoftConnectors package depends on the RJSONIO, gridExtra and ggplot2 packages that need to be installed from CRAN first using:
install.packages('RJSONIO') install.packages('ggplot2') install.packages('gridExtra')
Installation
The R package lixoftConnectors is located in the installation directory as tar.gz archive. It can be installed directly using Rstudio (Tools > Install packages > from package archive file) or with the following R command:
install.packages(packagePath, repos = NULL, type="source", INSTALL_opts ="--no-multiarch")
with the packagePath = ‘<installDirectory>/connectors/lixoftConnectors.tar.gz’ where <installDirectory> is the MonolixSuite installation directory.
With the default installation directory, the command is:
# for Windows OS install.packages("C:/Program Files/Lixoft/MonolixSuite2024R1/connectors/lixoftConnectors.tar.gz", repos = NULL, type="source", INSTALL_opts ="--no-multiarch")
# for Mac OS install.packages("/Applications/MonolixSuite2024R1.app/Contents/Resources/\ monolixSuite/connectors/lixoftConnectors.tar.gz", repos = NULL, type="source", INSTALL_opts ="--no-multiarch")
Note that for MonolixSuite version 2023 and earlier, the path to use for Windows OS is different:
# for Windows OS (MonolixSuite version 2023) install.packages("C:/ProgramData/Lixoft/MonolixSuite2023R1/connectors/lixoftConnectors.tar.gz", repos = NULL, type="source", INSTALL_opts ="--no-multiarch")
Note that for MonolixSuite version 2018, the R package is called MlxConnectors.
Initializing
When starting a new R session, you need to load the library and initialize the connectors with the following commands, specifying either “monolix”, “simulx”, or “pkanalix” for the software argument.
library(lixoftConnectors) initializeLixoftConnectors(software = "monolix")
In some cases, it may be necessary to specify the path to the installation directory of the Lixoft suite. If no path is given, the one written in the <user home>/lixoft/lixoft.ini file is used (usually “C:/Program Files/Lixoft/MonolixSuite2024R1” for Windows or “C:/ProgramData/Lixoft/MonolixSuiteXXXX” where XXXX corresponds to the version of MonolixSuite for earlier versions)
library(lixoftConnectors) initializeLixoftConnectors(software = "monolix", path = "/path/to/MonolixSuite/")
When you initialize the connectors with one application (e.g. “monolix”) and then initialize it again with another one (e.g. “simulx”), there is a security check asking you to agree with the switch. To bypass this check and avoid having to answer “yes” manually, you can specify the option “force = TRUE”:
library(lixoftConnectors) initializeLixoftConnectors(software = "monolix", force = TRUE)
Verifying the installation is correct
To test if the installation is correct, you can load and run a demo project as shown:
demoPath <- getDemoPath() loadProject(file.path(demoPath, "1.creating_and_using_models", "1.1.libraries_of_models", "theophylline_project.mlxtran")) runScenario() getEstimatedPopulationParameters()
These three commands should output the estimated population parameters (ka_pop, V_pop, Cl_pop, omega_ka, omega_V, omega_Cl, a, and b).