QuickStart R Packages

If you are unsure on how to get started using R on the cluster, see the R QuickStart guide first.

On the KSU HPC cluster, you can take a look at the user and system installed R packages.

[username@hpcprdssh02 ~]$ module load R
Loading R/3.4.0
Loading requirement: OpenMPI/2.1.1 OpenBLAS/0.2.19

[username@hpcprdssh02 ~]$ Rscript -e "library()"

Packages in library ‘/data/Apps/r/3.4.0/lib64/R/library’:

assertthat              Easy Pre and Post Assertions
backports               Reimplementations of Functions Introduced Since R-3.0.0
base                    The R Base Package
...
<spacebar><spacebar><spacebar>
...

XML                     Tools for Parsing and Generating XML Within R and S-Plus
xml2                    Parse XML
xtable                  Export Tables to LaTeX or HTML
xts                     eXtensible Time Series
yaml                    Methods to Convert R Data to YAML and Back

Note: Hit <spacebar> a few times to scroll through the entire list and 'q' to exit.

 

  • 1.  Create a new directory and move to this directory for package installation

    [username@hpcprdssh02 ~]$ mkdir ~/local/R_libs
    [username@hpcprdssh02 ~]$ cd ~/local/R_libs

    2. Copy the compressed file from your local machine to this directory, you can use a file transfer application (Ex. cyberduck) or a secure copy command shown below.

    [username@hpcprdssh02 R_libs]$ pwd
    /data/home/username/local/R_libs

    On your local machine, from a terminal:
    scp c:\Rpackagename_2.0.tar.gz username@hpc:/data/home/username/local/R_libs

    3. Make sure the R module is loaded

    [username@hpcprdssh02 R_libs]$ module load R

    Loading R/3.4.0
    Loading requirement: OpenMPI/2.1.1 OpenBLAS/0.2.19

    4. Run the command below to install the package to a specific directory. If we do not specify the path, installation will fail since by default the the package will be installed in root directory which you do not have access to.

    $ R CMD INSTALL --library=~/local/R_libs/ Rpackagename_2.0.tar.gz

    5. Open the R console and load the package:

    $ R
    > library("Rpackagename", lib="~/local/R_libs/")