User Tools

Site Tools


r

R

The “R” statistical/programming package is installed on the clusters. The greatest number of add-on packages are installed in the 4.0.2 version. Also included are older saved versions, newer 4.1.0 and R 4.2.2 and slightly modified Microsoft R Open 4.0.2 https://web.archive.org/web/20200808203121/https://analyttica.com/microsoft-r-or-open-source-r-which-suits-you-the-best/.

module load gcc/9.3.1 mkl/19.0.5 R/4.2.2

“gcc” module may be omitted unless you are adding R packages (see below). Substitute R/4.1.0 or MR/4.0.2 as desired for those versions. You can also add rstudio if you want the gui. This is best run through a portal (via interactive-apps Desktop or Rstudio GUI).

module load gcc/9.3.1 mkl/19.0.5 R/4.2.2 rstudio

If you need a new R package, you can ask hpc-support to add it to the central installation, or you can add your own packages as demonstrated below for the package “broman”. R is not as prone to conflicts as Python, so most packages can be added to the central installation without issues. Another way to create a custom installation is using conda, which would be better if you see conflicts with standard R. It will, however, install many thousands of files in your home.

For this simple installation, before starting, create files ~/.Rprofile and ~/.Renviron as shown, plus the R library directories (changing full version 4.2.2 to 4.2 in this example) and any of the other R environment variables you may want to set rstats.wtf.

pinnacle-l4:feynman:$ cat .Rprofile
options(repos = c(CRAN = "https://mirrors.nics.utk.edu/cran"))
pinnacle-l4:feynman:$ cat .Renviron
R_LIBS_USER=~/R/%p/%v
pinnacle-l4:feynman:$ cd;mkdir -p R
pinnacle-l4:feynman:$ mkdir -p R/x86_64-pc-linux-gnu
pinnacle-l4:feynman:$ mkdir -p R/x86_64-pc-linux-gnu/4.2

With those files in place you can install any R package yourself. Some redundant text output below has been omitted.

pinnacle-l4:feynman:$ module load gcc/9.3.1 mkl/19.0.5 R/4.2.2
pinnacle-l4:feynman:$ R
R version 4.2.2 (2022-10-31) -- "Innocent and Trusting"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

[Previously saved workspace restored]

> install.packages("broman")
Installing package into ‘/scrfs/storage/feynman/home/R/x86_64-pc-linux-gnu/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://mirrors.nics.utk.edu/cran/src/contrib/broman_0.76.tar.gz'
Content type 'application/x-gzip' length 79834 bytes (77 KB)
==================================================
downloaded 77 KB

* installing *source* package ‘broman’ ...
** package ‘broman’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -I"/share/apps/R/R-4.0.2/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c R_init.c -o R_init.o
gcc -I"/share/apps/R/R-4.0.2/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c compare_rows.c -o compare_rows.o
gcc -I"/share/apps/R/R-4.0.2/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c count_close.c -o count_close.o
gcc -I"/share/apps/R/R-4.0.2/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c normalize.c -o normalize.o
gcc -I"/share/apps/R/R-4.0.2/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c runningmean.c -o runningmean.o
gcc -shared -L/share/apps/R/R-4.0.2/lib64/R/lib -L/usr/local/lib64 -o broman.so R_init.o compare_rows.o count_close.o normalize.o runningmean.o -L/share/apps/R/R-4.0.2/lib64/R/lib -lR
installing to /scrfs/storage/feynman/home/R/x86_64-pc-linux-gnu/4.0/00LOCK-broman/00new/broman/libs
** R
** data
*** moving datasets to lazyload DB
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (broman)

The downloaded source packages are in
	‘/tmp/RtmpRuxu78/downloaded_packages’
> quit()
Save workspace image? [y/n/c]: n
pinnacle-l4:feynman:$
r.txt · Last modified: 2022/12/07 16:17 by root