Skip to content

Download

kaskr edited this page Aug 19, 2022 · 14 revisions

CRAN (all platforms)

In R type:

install.packages("TMB")

You will also need compiler tools.

Windows - installing required tools

On Windows, install the Rtools matching your R-version. From Rtools4.2 the procedure is simpler than before: Just click on the 'Rtools42 installer' and follow the instructions (you do not need to modify your PATH and you do not need to restart R after installing Rtools).

Windows debugger (gdb)

The debugger is recommended but not strictly required. To get it working under Rtools42:

  1. Start a shell by clicking StartMenu -> Rtools4.2 -> Rtools4.2-bash
  2. Install gdb by running the command (copy-paste doesn't work here)
    pacman -Sy gdb
  3. From R, modify your PATH permanently so the R executable can be found from the gdb shell:
    write('Sys.setenv(PATH=paste(R.home("bin"),Sys.getenv("PATH"),sep=";"))',file="~/.Rprofile",append = TRUE)
  4. Restart R and check that you can source a script through gdb:
    TMB::gdbsource("script.R",TRUE)

Mac OS - installing the required tools

On Mojave (Mac OS 10.14.1) it may be necessary to install command line developer tools by running the following two commands in a Terminal:

 xcode-select --install
 sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target / 

On High Sierra (Mac OS 10.13.1) it may be necessary to install command line developer tools by running the following code in a Terminal:

 xcode-select --install

On Mavericks (Mac OS 10.9) the Fortran compiler on the CRAN website does not work. More information and the solution can be found here. The easiest solution is to install the appropriate fortran libraries from r.research.att via the command line in Terminal:

curl -O http://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2
sudo tar fvxz gfortran-4.8.2-darwin13.tar.bz2 -C /

Test the installation

library(TMB)
## Optionally:
## precompile()
runExample(all=TRUE)

Run the example suite

To get the full suite of examples run:

download.file("https://github.com/kaskr/adcomp/archive/master.zip", "adcomp-master.zip")
unzip("adcomp-master.zip")

Change directory

setwd("adcomp-master/tmb_examples")

and run e.g. the sam example by

source("sam.R")