BwUniCluster3.0/Software/R: Difference between revisions

From bwHPC Wiki
Jump to navigation Jump to search
(Created page with "{{Softwarepage|math/R}} {| width=600px class="wikitable" |- ! Description !! Content |- | module load | math/R |- | License | GPL |- | Citing | n/a |- | Links | [http://www.r-project.org/ Homepage] | [http://cran.r-project.org/manuals.html Documentation] |- | Graphical Interface | No |- | Plugins | User dependent |} = Description = '''R''' is a free and open-source statistical programming environment based on S, developed at Bell Laboratories (formerly AT&T, now...")
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 26: Line 26:
= Description =
= Description =


'''R''' is a free and open-source statistical programming environment based on S, developed at Bell Laboratories (formerly AT&T, now Lucent Technologies) by John Chambers and colleagues in the 1970s. R can be considered as a different implementation of S. There are some important differences, but much code written for S runs unaltered under R.
'''R''' is a free and open-source statistical programming environment based on S, originally developed by John Chambers and colleagues at Bell Laboratories (formerly AT&T, now Lucent Technologies) in the 1970s. R can be considered a modern implementation of S and is known to be highly backward-compatible, meaning that code developed in a previous version will still run in a new version.


R provides a wide variety of statistical (linear and nonlinear modelling, classical statistical tests, time-series analysis, classification, clustering, ...) and graphical techniques, and is highly extensible. The S language is often the vehicle of choice for research in statistical methodology, and R provides an Open Source route to participation in that activity.
R provides a wide variety of statistical (linear and nonlinear modelling, classical statistical tests, time-series analysis, classification, clustering, ...) techniques and is highly extensible through packages.


One of R's strengths is the ease with which well-designed publication-quality plots can be produced, including mathematical symbols and formulae where needed. Great care has been taken over the defaults for the minor design choices in graphics, but the user retains full control.
Furthermore, R allows to produce well-designed publication-quality plots, including mathematical symbols and formulae, where needed.


R is available as Free Software under the terms of the Free Software Foundation's GNU General Public License in source code form. It compiles and runs on a wide variety of UNIX platforms and similar systems (including FreeBSD and Linux), Windows and macOS.
R is available as Free Software under the terms of the Free Software Foundation's GNU General Public License in source code form. It compiles and runs on a wide variety of UNIX platforms and similar systems (including FreeBSD and Linux), as well as Windows and macOS.

= Use R on bwUniCluster 3.0 =
The '''centrally maintained R module(s)''' should be '''preferred''' over alternatives like Conda or containerized setups when the '''computational performance is of major concern'''. The R installation(s) provided by these module(s) are built and optimized for the specific architecture and libraries of the cluster (e.g., OpenBLAS, MPI).

By contrast, if the '''focus''' is on '''portability''' of a data analytical workflow and '''maintaining many (external) dependencies''', '''containerized setups''' or '''Conda''' may provide useful alternatives to the native R installation.

Furthermore, the R installation also provides the standalone library <code>libRmath</code>. This library allows you to access R routines from your own C or C++ programs (see section 9 of the 'R Installation and Administration' manual).

== Loading the R software module ==
It is generally recommended to load a specific version of R, e.g.,

<pre>
$ module load math/R/4.4.2-openblas
</pre>

in data-analytical workflows instead of the default version which may change from time to time.


= Usage =
The R installation also provides the standalone library libRmath. This library allows you to access R routines from your own C or C++ programs (see section 9 of the 'R Installation and Administration' manual).


== Installing R-Packages into your home folder ==
== Installing R-Packages into your home folder ==
Line 57: Line 71:
The drawback is that, whenever switching to a new R release, the personal library stack '''must''' be rebuilt with that new R version into the corresponding (version specific) library path. This is considered good practice anyway in order to ensure a consistent personal library stack for any specific R version in use.
The drawback is that, whenever switching to a new R release, the personal library stack '''must''' be rebuilt with that new R version into the corresponding (version specific) library path. This is considered good practice anyway in order to ensure a consistent personal library stack for any specific R version in use.


Special care has also to be taken by users who always load the default version, i.e.


<pre>
$ module load math/R
</pre>

as the default version number may change any time. It is therefore highly recommended to always load a specific version, e.g.

<pre>
$ module load math/R/4.4.2-openblas
</pre>


== Pre-installed R-packages ==
== Pre-installed R-packages ==
Line 76: Line 80:
* doParallel
* doParallel


== Optional packages for R ==
== Installation instructions for selected R packages ==


The following guides provide detailed instructions about how to build selected optional R packages on '''bwUniCluster''' for '''R version 4.4.2'''. Please write a [https://www.bwhpc.de/supportportal ticket] if the instructions do not work for you or are outdated.
The following guides provide detailed instructions for building selected optional R packages on '''bwUniCluster''' for '''R version 4.4.2'''. Please write a [https://www.bwhpc.de/supportportal ticket] if the instructions do not work for you or are outdated.


* [[BwUniCluster3.0/Software/R/Rjags]]
* [[BwUniCluster3.0/Software/R/Rjags]]

Latest revision as of 12:22, 17 July 2025

The main documentation is available on the cluster via module help math/R. Most software modules for applications provide working example batch scripts.


Description Content
module load math/R
License GPL
Citing n/a
Links Homepage | Documentation
Graphical Interface No
Plugins User dependent

Description

R is a free and open-source statistical programming environment based on S, originally developed by John Chambers and colleagues at Bell Laboratories (formerly AT&T, now Lucent Technologies) in the 1970s. R can be considered a modern implementation of S and is known to be highly backward-compatible, meaning that code developed in a previous version will still run in a new version.

R provides a wide variety of statistical (linear and nonlinear modelling, classical statistical tests, time-series analysis, classification, clustering, ...) techniques and is highly extensible through packages.

Furthermore, R allows to produce well-designed publication-quality plots, including mathematical symbols and formulae, where needed.

R is available as Free Software under the terms of the Free Software Foundation's GNU General Public License in source code form. It compiles and runs on a wide variety of UNIX platforms and similar systems (including FreeBSD and Linux), as well as Windows and macOS.

Use R on bwUniCluster 3.0

The centrally maintained R module(s) should be preferred over alternatives like Conda or containerized setups when the computational performance is of major concern. The R installation(s) provided by these module(s) are built and optimized for the specific architecture and libraries of the cluster (e.g., OpenBLAS, MPI).

By contrast, if the focus is on portability of a data analytical workflow and maintaining many (external) dependencies, containerized setups or Conda may provide useful alternatives to the native R installation.

Furthermore, the R installation also provides the standalone library libRmath. This library allows you to access R routines from your own C or C++ programs (see section 9 of the 'R Installation and Administration' manual).

Loading the R software module

It is generally recommended to load a specific version of R, e.g.,

$  module load math/R/4.4.2-openblas

in data-analytical workflows instead of the default version which may change from time to time.


Installing R-Packages into your home folder

Since we cannot provide a software module for every R package, we recommend to install special R packages locally into your home folder. One option for doing this is from within an interactive R session:

> library()                                                                # List preinstalled packages
> install.packages('package_name', repos="http://cran.r-project.org")      # Installing your R package and the dependencies
> library(package_name)                                                    # Loading the package into you R instance

The package is now installed permanently in your home folder and is available every time you start R.

Note:

By default R uses a version (and platform) specific path for personal libraries, such as "$HOME/R/x86_64-pc-linux-gnu-library/x.y" for R version x.y.z. This directory will be created automatically (after confirmation) when installing a personal package for the first time.

A version specific path, such as the default path, allows users to maintain multiple personal library stacks for different (major and minor) R versions and does also prevent users from mixing their stack with libraries built with different R versions.

The drawback is that, whenever switching to a new R release, the personal library stack must be rebuilt with that new R version into the corresponding (version specific) library path. This is considered good practice anyway in order to ensure a consistent personal library stack for any specific R version in use.


Pre-installed R-packages

  • Rmpi
  • iterators
  • foreach
  • doMPI
  • doParallel

Installation instructions for selected R packages

The following guides provide detailed instructions for building selected optional R packages on bwUniCluster for R version 4.4.2. Please write a ticket if the instructions do not work for you or are outdated.