Installation

Fedora

The newest R release (including recommended packages as well as development headers and tools) can be installed by running

$ sudo dnf install R

or yum instead of dnf for older EPEL versions. This ‘R’ RPM is a meta-package. It has no content but ensures that the following components are installed

Component Description
R-core The minimal R components necessary for a functional runtime
R-core-devel Core files for development of R packages (no Java)
R-java R with Fedora-provided Java Runtime Environment
R-java-devel Development package for use with Java enabled R components
libRmath Standalone math library from the R project
libRmath-devel Headers from the R standalone math library

This division enables minimal installations (e.g., with no Java, with no development tools…), but generally R users will need all the components to be able to install any package from source. Therefore, it is recommended to install the ‘R’ meta-package.

EPEL for CentOS and RHEL

The Fedora RPMs for R have been ported to CentOS/RHEL by the project Extra Packages for Enterprise Linux (EPEL). These RPMs are also compatible with distributions derived from CentOS/RHEL.

To use the EPEL repository, it is sufficient to download and install the appropriate “epel-release” RPM, as described in the EPEL FAQ. Then R can be installed as described above.

Administration and maintenance

The R installation is divided in two directories:

In the same way,

Additionally, the R installation adds the following paths:

For example, these are the library paths for a x86_64 machine with R 4.0 installed:

.libPaths()
#> [1] "/home/<user>/R/x86_64-redhat-linux-gnu-library/4.0"
#> [2] "/usr/local/lib/R/library"
#> [3] "/usr/lib64/R/library"
#> [4] "/usr/share/R/library"

Supported packages

Recommended R packages are included as part of the R-core component. A number of add-on packages from CRAN, Bioconductor and other sources are readily available via the official repositories. Hence, running

$ dnf repoquery --repo=fedora-source R-*

provides a comprehensive list.

The listing below shows all RPMs available for R packages on Fedora 32 (Thirty Two), classified by the R repository that would normally be used to install the package from within R (see the help page ?chooseRepositories).

Click to toggle the list of packages

## $CRAN
##   [1] "abind"             "acepack"           "ape"              
##   [4] "argon2"            "ascii"             "askpass"          
##   [7] "assertthat"        "AUC"               "backports"        
##  [10] "base64enc"         "Bessel"            "biglm"            
##  [13] "bindr"             "bindrcpp"          "bit"              
##  [16] "bit64"             "bitops"            "blob"             
##  [19] "brew"              "broom"             "Cairo"            
##  [22] "callr"             "car"               "caTools"          
##  [25] "cellranger"        "chron"             "cli"              
##  [28] "cliapp"            "clipr"             "clisymbols"       
##  [31] "coda"              "colorspace"        "combinat"         
##  [34] "commonmark"        "corpus"            "crayon"           
##  [37] "curl"              "cyclocomp"         "data.table"       
##  [40] "date"              "DBI"               "dbplyr"           
##  [43] "debugme"           "deldir"            "desc"             
##  [46] "devtools"          "dichromat"         "diffobj"          
##  [49] "digest"            "disposables"       "doParallel"       
##  [52] "dplyr"             "dtplyr"            "ellipsis"         
##  [55] "errors"            "evaluate"          "expm"             
##  [58] "fansi"             "farver"            "fastmap"          
##  [61] "fastmatch"         "filehash"          "FMStable"         
##  [64] "foghorn"           "fontBitstreamVera" "fontLiberation"   
##  [67] "forcats"           "foreach"           "formatR"          
##  [70] "fortunes"          "fs"                "fts"              
##  [73] "futile.logger"     "futile.options"    "future"           
##  [76] "gamlss.dist"       "gapminder"         "gargle"           
##  [79] "gdata"             "gdtools"           "gee"              
##  [82] "geepack"           "generics"          "getPass"          
##  [85] "ggplot2"           "ggplot2movies"     "gh"               
##  [88] "git2r"             "globals"           "glue"             
##  [91] "gmailr"            "gmp"               "gplots"           
##  [94] "gsl"               "gss"               "gtable"           
##  [97] "gtools"            "haven"             "here"             
## [100] "hexbin"            "highlight"         "highr"            
## [103] "hms"               "htmltools"         "htmlwidgets"      
## [106] "httpuv"            "httr"              "hunspell"         
## [109] "igraph"            "import"            "ini"              
## [112] "inline"            "IRdisplay"         "IRkernel"         
## [115] "iterators"         "itertools"         "jose"             
## [118] "jpeg"              "jqr"               "jsonlite"         
## [121] "knitr"             "labeling"          "lambda.r"         
## [124] "later"             "lazyeval"          "lifecycle"        
## [127] "lintr"             "listenv"           "littler"          
## [130] "lmodel2"           "lmtest"            "lokern"           
## [133] "lubridate"         "magrittr"          "mapproj"          
## [136] "maps"              "mAr"               "markdown"         
## [139] "matrixStats"       "measurements"      "memoise"          
## [142] "microbenchmark"    "mime"              "miniUI"           
## [145] "mlbench"           "mnormt"            "mockery"          
## [148] "mockr"             "modelr"            "msm"              
## [151] "multcomp"          "munsell"           "mvtnorm"          
## [154] "nanotime"          "ncdf4"             "NISTunits"        
## [157] "nws"               "nycflights13"      "openssl"          
## [160] "orcutt"            "packrat"           "parsedate"        
## [163] "pbdRPC"            "pbdZMQ"            "pdftools"         
## [166] "pillar"            "pingr"             "pkgbuild"         
## [169] "pkgconfig"         "pkgdown"           "pkgload"          
## [172] "plogr"             "plyr"              "png"              
## [175] "poLCA"             "polyclip"          "polynom"          
## [178] "praise"            "prettycode"        "prettydoc"        
## [181] "prettyunits"       "processx"          "profvis"          
## [184] "progress"          "promises"          "ps"               
## [187] "purrr"             "qcc"               "qpdf"             
## [190] "qtl"               "quadprog"          "quantities"       
## [193] "R.cache"           "R.devices"         "R.methodsS3"      
## [196] "R.oo"              "R.rsp"             "R.utils"          
## [199] "R6"                "rappdirs"          "rcmdcheck"        
## [202] "RColorBrewer"      "Rcpp"              "RcppCCTZ"         
## [205] "RCurl"             "readr"             "readxl"           
## [208] "rematch"           "rematch2"          "remotes"          
## [211] "repr"              "reprex"            "repurrrsive"      
## [214] "reshape"           "reshape2"          "reticulate"       
## [217] "rex"               "rgdal"             "rgeos"            
## [220] "RhpcBLASctl"       "rhub"              "RInside"          
## [223] "rlang"             "rlecuyer"          "RM2"              
## [226] "rmarkdown"         "Rmpfr"             "RODBC"            
## [229] "roxygen2"          "rprintf"           "rprojroot"        
## [232] "rsconnect"         "RSQLite"           "rstudioapi"       
## [235] "rsvg"              "RUnit"             "rversions"        
## [238] "rvest"             "sandwich"          "scales"           
## [241] "scatterplot3d"     "sciplot"           "selectr"          
## [244] "sessioninfo"       "sfsmisc"           "shiny"            
## [247] "showtext"          "showtextdb"        "simmer"           
## [250] "snow"              "sodium"            "sourcetools"      
## [253] "sp"                "spelling"          "statnet.common"   
## [256] "stringdist"        "stringi"           "stringr"          
## [259] "styler"            "svglite"           "sys"              
## [262] "sysfonts"          "systemfit"         "systemfonts"      
## [265] "testit"            "testthat"          "TH.data"          
## [268] "tibble"            "tidyr"             "tidyselect"       
## [271] "tikzDevice"        "timeDate"          "timeSeries"       
## [274] "tinytest"          "tinytex"           "tkrplot"          
## [277] "tufte"             "tweenr"            "udunits2"         
## [280] "unitizer"          "units"             "unix"             
## [283] "usethis"           "utf8"              "uuid"             
## [286] "V8"                "vctrs"             "viridisLite"      
## [289] "waveslim"          "wavethresh"        "webp"             
## [292] "websocket"         "webutils"          "wesanderson"      
## [295] "whisker"           "whoami"            "withr"            
## [298] "xfun"              "XML"               "xml2"             
## [301] "xmlparsedata"      "xopen"             "xtable"           
## [304] "yaml"              "zeallot"           "zoo"              
## 
## $`BioC software`
##  [1] "affyio"               "Biobase"              "BiocGenerics"        
##  [4] "BiocParallel"         "biomaRt"              "Biostrings"          
##  [7] "BSgenome"             "BufferedMatrix"       "DelayedArray"        
## [10] "DynDoc"               "GenomeInfoDb"         "GenomicAlignments"   
## [13] "GenomicRanges"        "IRanges"              "preprocessCore"      
## [16] "qvalue"               "Rhtslib"              "Rsamtools"           
## [19] "rtracklayer"          "S4Vectors"            "SummarizedExperiment"
## [22] "tkWidgets"            "widgetTools"          "XVector"             
## 
## $`BioC annotation`
## [1] "GenomeInfoDbData"
## 
## $Omegahat
## [1] "Rcompression" "RCurl"        "XML"         
## 
## $`R-Forge`
##  [1] "abind"         "Bessel"        "bit"           "bit64"        
##  [5] "brew"          "car"           "colorspace"    "data.table"   
##  [9] "date"          "dichromat"     "digest"        "doParallel"   
## [13] "expm"          "foreach"       "fortunes"      "gamlss.dist"  
## [17] "gdata"         "gplots"        "gtools"        "highlight"    
## [21] "htmltools"     "iterators"     "itertools"     "labeling"     
## [25] "lmodel2"       "lokern"        "matrixStats"   "msm"          
## [29] "multcomp"      "mvtnorm"       "NISTunits"     "Rcpp"         
## [33] "rgdal"         "rgeos"         "Rmpfr"         "sandwich"     
## [37] "scatterplot3d" "stringi"       "systemfit"     "TH.data"      
## [41] "tikzDevice"    "timeDate"      "timeSeries"    "waveslim"     
## [45] "xtable"        "zoo"          
## 
## $rforge.net
##  [1] "Cairo"      "base64enc"  "brew"       "evaluate"   "fastmatch" 
##  [6] "formatR"    "highr"      "jpeg"       "knitr"      "markdown"  
## [11] "mime"       "png"        "testit"     "tikzDevice" "uuid"      
## 
## $Other
## [1] "Rsolid"

Note that the classification is not mutually exclusive (e.g. R-RCurl appears several times) and that there are RPMs that are not available from any standard R repository. These are listed under “Other”.

Additional packages

The cran2copr project maintains binary RPM repositories for the current and previous stable Fedora version for most of CRAN (more than 15k packages as of Jul. 2020) in an automated way using Fedora Copr.

These repositories are automatically synchronized with CRAN every day at 00:00 UTC through a GitHub Action that removes archived packages and builds the most recent updates. To ensure compatibility with the official repositories, these set of packages are named “R-CRAN-pkgname” (instead of “R-pkgname”), and are installed into /usr/local/lib/R/library.

To enable this Copr repository in your system:

$ sudo dnf install 'dnf-command(copr)'
$ sudo dnf copr enable iucar/cran
$ sudo dnf install R-CoprManager

The last command is optional, but recommended, because the CoprManager package integrates binary package installation into your R session. In this way, you can just run e.g.

install.packages("car")

in the R console, and the package will be automatically installed from the Copr repository. If a package is not available, then it just falls back to normal installation from CRAN.

On the other hand, remove.packages will still remove only packages installed in your user library. If you want to remove system packages, run:

CoprManager::remove_copr("car")

If you want to disable the CoprManager, so that install.packages only works with CRAN again, then run:

CoprManager::disable()
install.packages("car") # from CRAN to user lib

BLAS/LAPACK switching

Since Fedora 33, R (as well as Numpy, Octave and all the other BLAS/LAPACK consumers) is linked against FlexiBLAS, a BLAS/LAPACK wrapper library that enables runtime switching of the optimized backend (see the change proposal for further details), and the OpenMP version of OpenBLAS is set as the default backend.

The accompanying flexiblas R package enables BLAS/LAPACK switching without leaving the R session, as well as setting the number of threads for parallel backends (see the package’s README for further information).

$ sudo dnf install R-flexiblas # install FlexiBLAS API interface for R
$ sudo dnf install flexiblas-* # install all available optimized backends

Then, in an R session we see:

library(flexiblas)

# check whether FlexiBLAS is available
flexiblas_avail()
#> [1] TRUE

# get the current backend
flexiblas_current_backend()
#> [1] "OPENBLAS-OPENMP"

# list all available backends
flexiblas_list()
#> [1] "NETLIB"           "__FALLBACK__"     "BLIS-THREADS"     "OPENBLAS-OPENMP"
#> [5] "BLIS-SERIAL"      "ATLAS"            "OPENBLAS-SERIAL"  "OPENBLAS-THREADS"
#> [9] "BLIS-OPENMP"

# get/set the number of threads
flexiblas_set_num_threads(12)
flexiblas_get_num_threads()
#> [1] 12

This is an example of GEMM benchmark for all the backends available:

library(flexiblas)

n <- 2000
runs <- 10
ignore <- "__FALLBACK__"

A <- matrix(runif(n*n), nrow=n)
B <- matrix(runif(n*n), nrow=n)

# load backends
backends <- setdiff(flexiblas_list(), ignore)
idx <- flexiblas_load_backend(backends)

# benchmark
timings <- sapply(idx, function(i) {
  flexiblas_switch(i)

  # warm-up
  C <- A[1:100, 1:100] %*% B[1:100, 1:100]

  unname(system.time({
    for (j in seq_len(runs))
      C <- A %*% B
  })[3])
})

results <- data.frame(
  backend = backends,
  `timing [s]` = timings,
  `performance [GFlops]` = (2 * (n / 1000)^3) / timings,
  check.names = FALSE)

results[order(results$performance),]
#>            backend timing [s] performance [GFlops]
#> 1           NETLIB     56.776            0.2818092
#> 5            ATLAS      5.988            2.6720107
#> 2     BLIS-THREADS      3.442            4.6484602
#> 8      BLIS-OPENMP      3.408            4.6948357
#> 4      BLIS-SERIAL      3.395            4.7128130
#> 6  OPENBLAS-SERIAL      3.206            4.9906425
#> 7 OPENBLAS-THREADS      0.773           20.6985770
#> 3  OPENBLAS-OPENMP      0.761           21.0249671

Add-ons

The following add-ons are available in the official repositories:

Component Description
rstudio-desktop Integrated development environment for the R language
rstudio-server Access RStudio via a web browser
rkward Graphical front-end for the R language
emacs-ess Emacs Speaks Statistics under GNU Emacs

Reporting Problems

The best place to report problems with these packages or ask R questions specific to Fedora/EPEL is the R-SIG-Fedora mailing list. See https://stat.ethz.ch/mailman/listinfo/r-sig-fedora for more information.

Acknowledgements

Thanks to Martyn Plummer for maintaining a previous version of this page. The R stack for Fedora/EPEL is maintained by Tom “Spot” Callaway, Elliott Sales de Andrade, José Abílio Matos and Mattias Ellert among others. Additional CRAN RPMs for Fedora (15k+) are maintained by Iñaki Ucar, built and distributed through Fedora Copr. The Copr Build System is maintained by Miroslav Suchý, Pavel Raiskup, Jakub Kadlcik and many others. Thanks to Martin Koehler and Fabio Valentini for their invaluable assistance in bringing FlexiBLAS to Fedora.