The installation is in two steps:

  1. First carry out the instructions below for your OS

  2. Then install the package in R.

1) Install compilers for your OS


Windows:
It’s best to install the latest version of R (download).

Next you must install a set of compilers required for ctsmr to work: Download the version for your R version (Rtools) and install it. Please follow the instructions and remember the step to put Rtools on the PATH.
For 3.x versions, you mostly you do not have to change any settings during the installation of Rtools (however in few rare cases it has been necessary to “add rtools to system PATH” see this here).


macOS (OS X 10.11 or higher):
Compilers must be installed after installing R, so:


Download Gfortran 6.1 https://cloud.r-project.org/bin/macosx/tools/gfortran-6.1.pkg and install it.

Install an Apple provided Clang4 by executing “xcode-select –install” in a Terminal. You can also download Clang6 https://cloud.r-project.org/bin/macosx/tools/clang-6.0.0.pkg and install it.


You may have to tell R where to find the newly installed compilers. This is done through a text file “Makevars”. In a Terminal run:


# Create a folder .R in the user folder. 
mkdir ~/.R
# Download Makevars
curl -o ~/.R/Makevars http://ctsm.info/Makevars.macos 


Linux:
Use any newer version of R and make sure to install gcc and gfortran through the package manager of your OS.


2) Install the ctsmr R package

Open R using e.g. Rstudio. In the Console run:


# Create a folder .R in the user folder
install.packages("ctsmr", repos = c(ctsmr = "http://ctsm.info/repo/dev", getOption("repos")))
In case you get the warning: “Package is only available in source form…”) then answer “Yes” to the question about installing from source. To avoid this warning and always install from source use:


install.packages("ctsmr", repos = c(ctsmr = "http://ctsm.info/repo/dev", getOption("repos")), type="source")
ctsmr is now ready for continous time stochastic modelling.