Both sides previous revision
Previous revision
Next revision
|
Previous revision
Last revision
Both sides next revision
|
r [2021/12/14 18:26] root |
r [2022/12/07 16:08] root |
=== R === | === R === |
| |
The "R" statistical/programming package is installed on the clusters. Most add-on packages are in the 4.0.2 version. Also included are slightly newer 4.1.0 and slightly modified Microsoft R 4.0.2, plus older saved versions. | 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 slightly newer 4.1.0 and R 4.2.2 and slightly modified Microsoft R Open 4.0.2, plus older saved versions. See [[https://www.analyttica.com/microsoft-r-or-open-source-r-which-suits-you-the-best/|R vs. Microsoft R]]. |
| |
<code> | <code> |
module load gcc/7.3.1 mkl/19.0.4 R/4.0.2 | module load gcc/9.3.1 mkl/19.0.5 R/4.2.2 |
| </code> |
| "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 most easily run through a portal. |
| <code> |
| module load gcc/9.3.1 mkl/19.0.5 R/4.2.2 rstudio |
</code> | </code> |
"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. | |
| |
If you need a new R package, you can ask support to add it to the central installation, or you can add your own packages as shown 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 [[python|conda]], which would be better if you see conflicts with standard ''R'', at the cost of installing thousands of files. | 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 [[python|conda]], which would be better if you see conflicts with standard ''R''. It will, however, install many thousands of files in your home. |
| |
Before starting, create files ~/.Rprofile and ~/.Renviron as shown, plus other variables you may need. See [[https://rstats.wtf/r-startup.html|rstats.wtf]]. Some redundant text output has been omitted. | For this simple installation, before starting, create files ~/.Rprofile and ~/.Renviron as shown, plus other variables you may want to set. See [[https://rstats.wtf/r-startup.html|rstats.wtf]]. Some redundant text output has been omitted. |
| |
| The files ~/.Rprofile and ~/.Renviron should look like this. Also create ``mkdir -p`` the R library directories as shown with the major version of R that you are using (changing 4.2.2 to 4.2 in this case). |
<code> | <code> |
pinnacle-l4:feynman:$ cat .Rprofile | pinnacle-l4:feynman:$ cat .Rprofile |
pinnacle-l4:feynman:$ cat .Renviron | pinnacle-l4:feynman:$ cat .Renviron |
R_LIBS_USER=~/R/%p/%v | R_LIBS_USER=~/R/%p/%v |
pinnacle-l4:feynman:$ module load gcc/7.3.1 mkl/19.0.4 R/4.0.2 | 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 |
| </code> |
| |
| With those files in place you can install any R package yourself. Your packages will be installed into |
| a directory in your /home directory. In this example '/scrfs/storage/feynman/home/R/x86_64-pc-linux-gnu/4.2': |
| |
| <code> |
| pinnacle-l4:feynman:$ module load gcc/9.3.1 mkl/19.0.5 R/4.2.2 |
pinnacle-l4:feynman:$ R | 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) |
| |
R version 4.0.2 (2020-06-22) -- "Taking Off Again" | |
[Previously saved workspace restored] | [Previously saved workspace restored] |
| |