Versionen im Vergleich

Schlüssel

  • Diese Zeile wurde hinzugefügt.
  • Diese Zeile wurde entfernt.
  • Formatierung wurde geändert.

Eine weit verbreitete Programmierumgebung für statistische Berechnungen und Grafiken.

Inhalt
typeflat

Versionen

Aktuell ist Version 3.5.3haben wir auf dem Cluster Version 4.3.3 als neueste Version von R installiert. Aus Gründen der Kompatibilität werden auf dem Cluster jedoch auch ältere Versionen (siehe rechte Spalte) angeboten.

Alle Versionen sind wurden mit dem Intel Compiler aus dem Intel® Parallel Studio XE übersetzt und sind gegen die Intel MKL gelinkt.

Die Version 4.3.3 wurde mit dem GNU C-Compiler 13.2.0 übersetzt. Diese Version ist mit dem Befehl

Codeblock
module load R/4.3.3-gcc

zu laden. In der Version R/4.3.3-gcc stehen auch die meisten vom System her schon bereitgestellten Pakete/Bibliotheken (libraries) zur Verfügung. Diese können mit dem library() Befehl geladen werden.

Info
titleLatest Information

Currently we have a mirror for CRAN to allow you to install packages without direct internet access. Please use http://cran.repo.test.hhu.de/ as mirror on Hilbert.

We have also installed a mirror for Bioconductor, use 

Codeblock
options(BioC_mirror = "http://bioc.repo.test.hhu.de")

in R to access the local mirror (working with R Versions 4.0.3, 4.2.2, 4.3.2 and 4.3.3).

To make it easier you can create the file .Rprofile in your home directory with contents:

Codeblock
options(
    repos = c(CRAN_mirror = "http://cran.repo.test.hhu.de"),
    BioC_mirror = "http://bioc.repo.test.hhu.de"
       )

This way you do not need to specify the mirrors every time you want to install new packages.

 

Zusatzpakete

Eine Liste aller Zusatzpakete innerhalb von R erhält man mit:

Codeblock
languagecpp
themeEclipse
titleListe aller Pakete in R
ip <- as.data.frame(installed.packages()[,c(1,3:4)])
rownames(ip) <- NULL
ip <- ip[is.na(ip$Priority),1:2,drop=FALSE]
print(ip, row.names=FALSE)

 

In der aktuellen Version sind folgende Zusatzpakete vorhanden (Stand 14.05.2019):


PaketVersion
assertthat0.2.1
BH1.69.0-1
bigmemory4.5.33
bigmemory.sri0.1.3
bit1.1-14
cli1.1.0
coda0.19-2
colorspace1.4-1
crayon1.3.4
deSolve1.21
doParallel1.0.14
foreach1.4.4
glue1.3.1
iterators1.0.10
lazyeval0.2.2
magrittr15
plyr1.8.4
Rcpp1.0.1
reshape0.8.8
reshape21.4.3
stringi1.4.3
stringr1.4.0
SuppDists1.1-9.4
whisker0.3-2

 

Pakete, die in der Version R/4.3.3-gcc, die mit dem Gnu-Compiler übersetzt wurden, zur Verfügung stehen, sind die folgenden (Stand 04.04.2024): 

PackageVersion
abind1.4-5
alphavantager0.1.3
anytime0.3.9
ape5.7-1
aplot0.2.2
askpass1.2.0
assertthat0.2.1
backports1.4.1
base64enc0.1-3
BH1.81.0-1
bigmemory4.6.1
bigmemory.sri0.1.6
binom1.1-1.1
bit4.0.5
bit644.0.5
blob1.2.4
brew1.0-10
brio1.1.4
broom1.0.5
bslib0.6.1
cachem1.0.8
callr3.7.3
car3.1-2
carData3.0-5
cellranger1.1.0
cli3.6.2
clipr0.8.0
clock0.7.0
coda0.19-4
colorspace2.1-0
commonmark1.9.0
conflicted1.2.0
cpp110.4.7
crayon1.5.2
credentials2.0.1
crosstalk1.2.1
curl5.2.0
data.table1.14.10
DBI1.2.0
dbplyr2.4.0
desc1.4.3
deSolve1.40
devtools2.4.5
diagram1.6.5
diffobj0.3.5
digest0.6.33
doParallel1.0.17
downlit0.4.3
dplyr1.1.4
dqrng0.3.2
dtplyr1.3.1
ellipsis0.3.2
evaluate0.23
fansi1.0.6
farver2.1.1
fastmap1.1.1
FNN1.1.3.2
fontawesome0.5.2
forcats1.0.0
foreach1.5.2
forecast8.21.1
fracdiff1.5-2
fs1.6.3
furrr0.3.1
future1.33.0
future.apply1.11.0
gargle1.5.2
generics0.1.3
gert2.0.1
ggforce0.4.1
ggfun0.1.3
ggplot23.4.4
ggplotify0.1.2
ggraph2.1.0
ggrepel0.9.4
ggtree3.10.0
gh1.4.0
gitcreds0.1.2
globals0.16.2
glue1.6.2
googledrive2.1.1
googlesheets41.1.1
gower1.0.1
graphlayouts1.0.2
gridExtra2.3
gridGraphics0.5-1
gtable0.3.4
hardhat1.3.0
haven2.5.4
highr0.10
hms1.1.3
htmltools0.5.7
htmlwidgets1.6.4
httpuv1.6.13
httr1.4.7
httr21.0.0
ids1.0.1
igraph1.6.0
ini0.3.1
ipred0.9-14
irlba2.3.5.1
isoband0.2.7
iterators1.0.14
jquerylib0.1.4
jsonlite1.8.8
knitr1.45
labeling0.4.3
later1.3.2
lava1.7.3
lazyeval0.2.2
lifecycle1.0.4
listenv0.9.0
lme41.1-35.1
lmerTest3.1-3
lmtest0.9-40
lubridate1.9.3
magrittr2.0.3
MatrixModels0.5-3
memoise2.0.1
mime0.12
miniUI0.1.1.1
minqa1.2.6
modelr0.1.11
munsell0.5.0
nloptr2.0.3
numDeriv2016.8-1.1
openssl2.1.1
padr0.6.2
parallelly1.36.0
pastecs1.3.21
patchwork1.1.3
pbkrtest0.5.2
PerformanceAnalytics2.0.4
pillar1.9.0
pkgbuild1.4.3
pkgconfig2.0.3
pkgdown2.0.7
pkgload1.3.3
plotly4.10.3
plotrix3.8-4
plyr1.8.9
polyclip1.10-6
praise1.0.0
prettyunits1.2.0
processx3.8.3
prodlim2023.08.28
profvis0.3.8
progress1.2.3
progressr0.14.0
promises1.2.1
ps1.7.5
purrr1.0.2
quadprog1.5-8
Quandl2.11.0
quantmod0.4.25
quantreg5.97
R62.5.1
ragg1.2.7
rappdirs0.3.3
rcmdcheck1.4.0
RColorBrewer1.1-3
Rcpp1.0.11
RcppAnnoy0.0.21
RcppArmadillo0.12.6.6.1
RcppEigen0.3.3.9.4
RcppProgress0.4.2
RcppRoll0.3.0
readr2.1.4
readxl1.4.3
recipes1.0.9
rematch2.0.0
rematch22.1.2
remotes2.4.2.1
reprex2.0.2
reshape0.8.9
reshape21.4.4
riingo0.3.1
rlang1.1.2
RLRsim3.1-8
rmarkdown2.25
roxygen27.3.1
rprojroot2.0.4
rsample1.2.0
rstudioapi0.15.0
rversions2.1.2
rvest1.0.3
sass0.4.8
scales1.3.0
selectr0.4-2
sessioninfo1.2.2
shape1.4.6
shiny1.8.0
simr1.0.7
sitmo2.0.2
slider0.3.1
sourcetools0.1.7-1
SparseM1.81
SQUAREM2021.1
stringi1.8.3
stringr1.5.1
SuppDists1.1-9.7
sys3.4.2
systemfonts1.0.5
testthat3.2.1
textshaping0.3.7
tibble3.2.1
tidygraph1.3.0
tidyquant1.0.7
tidyr1.3.0
tidyselect1.2.0
tidytree0.4.6
tidyverse2.0.0
timechange0.2.0
timeDate4032.109
timetk2.9.0
tinytex0.49
treeio1.26.0
tseries0.10-55
tsfeatures1.1.1
TTR0.24.4
tweenr2.0.2
tzdb0.4.0
urca1.3-3
urlchecker1.0.1
usethis2.2.2
utf81.2.4
uuid1.1-1
uwot0.1.16
vctrs0.6.5
viridis0.6.4
viridisLite0.4.2
vroom1.6.5
waldo0.5.2
warp0.2.1
whisker0.4.1
withr2.5.2
xfun0.41
xml21.3.6
xopen1.0.0
xtable1.8-4
xts0.13.1
yaml2.3.8
yulab.utils0.1.1
zip2.3.1
zoo1.8-12


Eigene Pakete hinzufügen

R ermöglicht es, eigene bzw. zusätzliche Pakete in das Homeverzeichnis Home-Verzeichnis zu installieren. Dazu müssen Sie muss zunächst von CRAN das Sourcepaket (.gewünschte Source-Paket (im tar.gz) herunterladen und dieses danach installieren wie folgt-Format) herunterladen werden. Danach kann dies, z. B. in einem interaktiven Job, wie folgt installiert werden:

  1. R-Modul laden

    Codeblock
    languagebash
    module load R/4.3.3.2-gcc


  2. Verzeichnis(se) für weiter weitere Pakete anlegen (falls noch nicht geschehen)

    Codeblock
    languagebash
    mkdir ~/R/; mkdir -p ~/R/libs/


  3. diesen neuen Pfad für R bekannt machen

    Codeblock
    languagebash
    echo 'R_LIBS_USER="~/R/libs"' >>>  $HOME/.Renviron


  4. neues Paket (als Beispiel mypackage.tar.gz) in diesen Pfad installieren

    Codeblock
    languagebash
    R CMD INSTALL -l ~/R/libs/ mypackage.tar.gz


Sollen weitere Pakete installiert werden, dann erübrigen sich die ersten Schritte (insbesondere 2. und 3.).


Info
titleTipp für andere Archiv-Formate

R scheint an dieser Stelle nur tar.gz-Archive zu verstehen. Leider bieten manche Download-Seiten aber nur andere Archiv-Formate, wie bspw. ZIP, zum Herunterladen an. Falls dies der Fall sein sollte, kann man mittels

unzip mypackage.zip
das heruntergeladene Archiv entpacken und dann mittels
tar --create --verbose --gzip --file=mypackage.tar.gz mypackage/
wieder in ein tar.gz-Archiv packen. Damit sollte dann der 4. Schritt funktionieren.


Info
titleBeispielinstallation mittels CRAN
$ mkdir -p ~/R/libs
$ module load R/4.3.3-gcc
$ R
> install.packages("tidyselect", lib = "~/R/libs/", repos = "http://cran.repo.test.hhu.de/")
...
* DONE (tidyselect)

Parallel Execution

It is possible in R to execute methods in parallel across multiple cores with the library 'parallel': https://dept.stat.lsa.umich.edu/~jerrick/courses/stat701/notes/parallel.html. The method detectCores() returns incorrect numbers and should not be used. A good replacement is https://github.com/HenrikBengtsson/parallelly.  To the best of our knowledge other commonly used R libraries for parallel Execution as 'doParallel', 'doSNOW' or 'foreach' are only addressing one core.

A second possibility is - if possible - seperating your job in the RScript into several tasks (below 200 tasks from 0 to 199).

Codeblock
languagebash
firstline1
titleYourShellScript.sh
linenumberstrue
#!/bin/bash
#PBS -A YourProject
#PBS -l select=1:ncpus=1:mem=8G
#PBS -l walltime=01:59:00
#PBS -r y
#PBS -J 0-199

module load R/4.3.2-gcc

jobargs=$(echo "'--args ${PBS_ARRAY_INDEX}'")
jobstr=$(echo "R CMD BATCH --no-save --no-restore ${jobargs} your_script.R your_script.Rout")
eval ${jobstr}

The job argument (0 to 199 in this example) can be used in your RScript as followed:

Codeblock
titleyour_script.R
args = commandArgs(TRUE)
...

Of course both ways to parallel processing using R can be combined by creating several jobs which use multiple cores with the library 'parallel'.

Common Errors

error #308: member "std::complex::_M_value" (declared at line 1337 of "/usr/include/c++/4.8.5/complex") is inaccessible

The Intel compiler, that we use to build R, conflicts with gcc headers when using complex data types, resulting in an error similar to the one below when installing some R libraries:

Codeblock
/software/intel/xe2019/compilers_and_libraries_2019.0.117/linux/compiler/include/complex(310): error #308: member "std::complex<double>::_M_value" (declared at line 1337 of "/usr/include/c++/4.8.5/complex") is inaccessible

The workaround this is to disable this diagnostic error by creating (or modifying) file ~/.R/Makevars such as:
Codeblock
languagebash
title~/.R/Makevars
 CFLAGS += -wd308
CXXFLAGS += -wd308
CPPFLAGS += -wd308
PKG_CFLAGS += -wd308
PKG_CXXFLAGS += -wd308
PKG_CPPFLAGS += -wd308


Inhalt

verfügbare Versionen
3.0.2
3.2.3
3.3.2

3.5.3

3.6.1

4.0.3

4.2.2

4.3.2

4.3.3