This is an old revision of the document!
R is a free software environment for statistical computing and graphics.
See versions of R that are available:
$ module avail R
Load one version into your environment and run it:
$ module load R/4.0 $ R
installed.packages() to check the list of packages installed in the ILRI environment by default. Here is a good resource on installing R packages into user libraries if you need other packages.
Notes from the sysadmin during installation.
First, compile the main R application with GCC 7 from Red Hat's
devtoolset-7 software collection:
$ cd /tmp $ wget https://cran.r-project.org/src/base/R-4/R-4.0.3.tar.gz $ cd R-4.0.3 # install packages to enable capabilities in R $ sudo yum install libX11-devel libXaw-devel bzip2-devel libcurl-devel xz-devel readline-devel glibc-headers pcre2-devel.x86_64 # install a newer compiler from Red Hat software collections $ sudo yum install devtoolset-7-gcc devtoolset-7-gcc-gfortran devtoolset-7-libquadmath-devel devtoolset-7-gcc-c++ $ scl enable devtoolset-7 bash # R packages are written in C99 and GCC 7 uses a newer standard by default, so tell configure script to use C99 explicitly $ export CFLAGS='-std=gnu99 -g -O2' $ ./configure --enable-R-shlib --prefix=/export/apps/R/4.0 $ make -j4 $ sudo mkdir -p /export/apps/R/4.0 $ sudo chown aorth:aorth /export/apps/R/4.0 $ make install
Then install some common libraries used by our users because some of them are quite complicated, and installing them globally saves tens of thousands of header files and libraries being installed into user libraries anyways:
$ /export/apps/R/4.0/bin/R > install.packages('sf', repo='https://cloud.r-project.org', configure.args=c(sf = '--with-gdal-config=/export/apps/gdal/2.4.2/bin/gdal-config')) > install.packages("hierfstat", repos="https://cran.r-project.org") > install.packages("adegenet", repos="https://cran.r-project.org") > install.packages("BiocManager", repos="https://cran.r-project.org") > install.packages("poppr", repos="https://cran.r-project.org") > install.packages("vcfR", repos="https://cran.r-project.org") > q() $ sudo chown -R root:root /export/apps/R/4.0
Note: some of these packages will need system libraries installed, for example: