R-package installation and initialization

In this page, we present the installation procedure of the R-package lixoftConnectors that allow to run PKanalix from R.

Installation

The R package lixoftConnectors is located in the installation directory as tar.gz ball. It can be installed directly using Rstudio (Tools > Install packages > from package archive file) or by the following R command:

install.packages(packagePath, repos = NULL, type="source", INSTALL_opts ="--no-multiarch")

with 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:/ProgramData/Lixoft/MonolixSuite2023R1/connectors/lixoftConnectors.tar.gz", 
                 repos = NULL, type="source", INSTALL_opts ="--no-multiarch")
# for Mac OS
install.packages("/Applications/MonolixSuite2023R1.app/Contents/Resources/monolixSuite/connectors/lixoftConnectors.tar.gz",
                 repos = NULL, type="source", INSTALL_opts ="--no-multiarch")

The lixoftConnectors package depends on the RJSONIO and ggplot2 packages that may need to be installed from CRAN first using:

install.packages('RJSONIO')
install.packages('ggplot2')

Initializing

When starting a new R session, you need to load the library and initialize the connectors with the following commands

library(lixoftConnectors)
initializeLixoftConnectors(software = "pkanalix")

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:/ProgramData/Lixoft/MonolixSuiteXXXX” for Windows) where XXXX corresponds to the version of MonolixSuite.

library(lixoftConnectors) 
initializeLixoftConnectors(software = "pkanalix", path = "/path/to/MonolixSuite/")

Making sure the installation is ok

To test if the installation is ok, you can load and run a project from the demos as on the following:

demoPath = '<userFolder>/lixoft/pkanalix/pkanalix2019R1/demos/1.basic_examples/'
loadProject(paste0(demoPath ,'project_ivbolus.pkx'))
runNCAEstimation()
getNCAIndividualParameters()

where <userFolder> is the user’s home folder (on windows C:/Users/toto if toto is your username). These three commands should output the estimated NCA parameters.