Skip to contents

The workflows implemented in esqlabsR rely on functionalities of the {ospsuite-r} package that require PK-Sim. It is necessary that the version of {ospsuite-r} matches the version of PK-Sim. When using the released version of {ospsuite-r}, it is sufficient to install the corresponding OSPS release. However, the current version of esqlabsR relies on features implemented in the {ospsuite-r} and PK-Sim that are still under development and have not been released. This document describes how to get the PK-Sim version matching the latest {ospsuite-r}.

It is possible to install PK-Sim globally for the whole system, but also locally on a per-project basis. The following sections describe both options.

Install PK-Sim Globally

Download PK-Sim

Download the latest portable version of PK-Sim by clicking here.

Enable using .dll from zip

Windows Defender prevents applications downloaded from untrusted sources from being loaded. Before extracting the downloaded portable version, you have to unblock it.

  1. Right click on the downloaded archive and select “Properties” (on Windows 11, you have to select “Show more options” first),
  2. In the Properties-window, select the checkbox “Unblock”.

Restart R session

Make sure that no instance of ospsuite is loaded. If so, restart the R session, as otherwise you might not be able to overwrite the existing portable version of PK-Sim.

Extract PK-Sim

Extract the downloaded portable PK-Sim to C:/Program Files/Open Systems Pharmacology/PK-Sim 12.0.
Change the version number in the folder name to match the PK-Sim version you downloaded while keeping only the two digits. For example, if you downloaded PK-Sim 12.0.1, the folder name should be PK-Sim 12.0.

Install and use PK-Sim in a project

In the project’s folder, run the following code that will download the latest PK-Sim “minimal” version and extract it to a folder called PKSim.

download.file("https://ci.appveyor.com/api/projects/open-systems-pharmacology-ci/ospsuite-r/artifacts/pksim_minimal.zip",
              destfile = "pksim_minimal.zip"
)
unzip("pksim_minimal.zip", exdir = "PKSim")
file.remove("pksim_minimal.zip")

Then, include the following code lines at the begining of the projects scripts:

ospsuite::initPKSim(pksimFolderPath = "PKSim")

Alternatively, it is possible to add the line above to a .Rprofile file in the project’s folder. This will ensure that the PK-Sim version is initialized when the project is opened in RStudio. You can create a .Rprofile file by running the following code:

usethis::edit_r_profile(scope = "project")