Skip to content

Installing_ToxicR

Matthew Wheeler edited this page Apr 24, 2023 · 5 revisions

Installing ToxicR

One can install Toxic R on Windows, macOS, and Linux. The compiled packages are available here, and we are working to have them available for CRAN. Despite this availability, one might want to have a custom installation. Specifically, macOS does not currently support OpenMP, and users may wish to compile a version that supports OpenMP. Further, by default, Linux versions compile with OpenMP support. Users on HPC systems may want to control this behavior. In what follows, we give some tips to compile OpenMP. We stress that this is a use at your own risk endeavor! We take no liability for any changes to your system that might result.

R dependencies

The following libraries are required to run ToxicR:

  • Rcpp (>= 1.0.0),
  • ggplot2 (>= 3.3.2), shiny (>= 1.5.0),
  • plotly (>= 4.9.2.1),
  • scales (>= 1.1.1),
  • tidyverse (>= 1.3.0),
  • forcats,
  • ggridges (>= 0.5.3),
  • doBy (>= 4.6.11),
  • modules,
  • multcomp (>= 1.4),
  • VIM (>= 6.1.1),
  • gridExtra (>= 2.3),
  • knitr (>= 1.36),
  • dplyr (>= 1.0.7),
  • ggpubr (>= 0.4.0),
  • bibtex (>= 0.4.2.3),
  • testthat (>= 3.1.0),
  • actuar (>= 3.2-0).

The installation will not succeed without these dependencies.

Recommended Method

Compile Yourself

If you have the package devtools, you can download and install directly from GitHub!

library(devtools) devtools::install_github("NIEHS/ToxicR")

Note: For Windows, you will need the rtools executable available at: https://cran.r-project.org/bin/windows/Rtools/

Note: If you have a MacOS, you will need to download the GNU Scientific Library. To do this, go to a command line and type

brew install gsl

This assumes you have HomeBrew installed. If you do not go to https://brew.sh, which will give you the instructions on how to install.

Note: For MacOS, you also need to install xcode. To do this go to the command line and type

xcode-select -install

Note: For Linux, you will also need the GNU Scientific Library. The install depends on your flavor of Linux. For Ubuntu, type

sudo apt-get install libgsl-dev

Alternative Methodology

First, install the required packages

install.packages(c("Rcpp","RcppEigen","RcppGSL","ggplot2","shiny","coda","scales","tidyverse","forcats","ggridges","doBy","multcomp","dplyr","rmarkdown", "actuar","ggpubr", "testthat","gridExtra","VIM","knitr", "modules", "plotly" ))

Windows R 4.3.0

download.file("https://github.com/NIEHS/ToxicR/releases/download/v1.10.0/ToxicR_23.4.1.1.0.R4.3.zip", "ToxicR_23.4.1.1.0.zip") install.packages("ToxicR_23.4.1.1.0.zip", repos = NULL, type = "win.binary")

Windows R 4.2.3

download.file("https://github.com/NIEHS/ToxicR/releases/download/v1.10.0/ToxicR_23.4.1.1.0R4.2.3.zip", "ToxicR_23.4.1.1.0.zip") install.packages("ToxicR_23.4.1.1.0.zip", repos = NULL, type = "win.binary")

Linux Installation

To install ToxicR in Linux, several dependencies beyond those required in R are required. Specifically, one needs the following libraries:

On most Linux distributions, one does not need to compile these libraries. For example, in Ubuntu, one needs to do the following in a terminal window:

sudo update 
sudo upgrade
sudo apt-get install libgsl-dev libnlopt-dev pandoc

When these dependencies are met, one needs to download the current code from ToxicR git. From the command line, assuming git is installed, one type:

git clone https://github.com/NIEHS/ToxicR/

Then, assuming R is installed, and all R dependencies are met type:

R CMD build ToxicR
R CMD INSTALL ToxicR

At this point, ToxicR should be installed. Note, by default, R compiles using one processor, which will make the installation take some time. If you have a multi-core machine, you can tell R to use more than one core. To do this, go to your home directory (e.g. cd ~) and see if there is a .R directory. If it doesn't exist, type the following:

mkdir .R
cd .R
echo 'MAKEFLAGS =-j4' > Makevars

Note: Above, the 4 can be replaced with the number of processors you have. For example, if you have a 24 core machine type

echo 'MAKEFLAGS =-j24' > Makevars

You can then run the command R CMD build ToxicR etc. and the install will take less time.