Chapter 4 Installation

You can install the released version of RxODE from CRAN with:

install.packages("RxODE")

You can install the development version of RxODE with

devtools::install_github("nlmixrdevelopment/RxODE")

To build models with RxODE, you need a working c compiler. To use parallel threaded solving in RxODE, this c compiler needs to support open-mp.

You can check to see if R has working c compiler you can check with:

## install.packages("pkgbuild")
pkgbuild::has_build_tools(debug = TRUE)

If you do not have the toolchain, you can set it up as described by the platform information below:

4.0.1 Windows

In windows you may simply use installr to install rtools:

install.packages("installr")
library(installr)
install.rtools()

Alternatively you can download and install rtools directly.

4.0.2 Mac OSX

To get the most speed you need OpenMP enabled and compile RxODE with that compiler. There are various options and the most up to date discussion about this is likely the data.table installation faq for MacOS. The last thing to keep in mind is that RxODE uses the code very similar to the original lsoda which requires the gfortran compiler to be setup as well as the OpenMP compilers.

If you are going to be using RxODE and nlmixr together and have an older mac computer, I would suggest trying the following:

library(symengine)

If this crashes your R session then the binary does not work with your Mac machine. To be able to run nlmixr, you will need to compile this package manually. I will proceed assuming you have homebrew installed on your system.

On your system terminal you will need to install the dependencies to compile symengine:

brew install cmake gmp mpfr libmpc

After installing the dependencies, you need to reinstall symengine:

install.packages("symengine", type="source")
library(symengine)

4.0.3 Linux

To install on linux make sure you install gcc (with openmp support) and gfortran using your distribution’s package manager.

4.1 Development Version

Since the development version of RxODE uses StanHeaders, you will need to make sure your compiler is setup to support C++14, as described in the rstan setup page. For R 4.0, I do not believe this requires modifying the windows toolchain any longer (so it is much easier to setup).

Once the C++ toolchain is setup appropriately, you can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("nlmixrdevelopment/RxODE")