This function is responsible for compiling a version of the R language.

rcompiler(x = NULL, with_blas = NULL, complementary_flags = NULL)

Arguments

x

Version of R you want to compile. By default (x = NULL) will be compiled the latest stable version of the R language. For example, x = "3.6.2" will compile and link R-3.6.2 version as the major version on your system.

with_blas

String, --with-blas = NULL by default, with flags for --with-blas used in the R compilation process. Details on the use of this flag can be found here.

complementary_flags

String, complementary_flags = NULL by default, for adding complementary flags in the R language compilation process.

Value

Returns a warning message informing you if the procedure occurred correctly. You will also be able to receive information about missing dependencies.

Details

This function is responsible for compiling a version of the R language. The x argument is the version of R that you want to compile. For example, x = "4.0.0" will compile and link R-4.0.0 version as the major version on your system. By default (x = NULL) will be compiled the latest stable version of the R.

For example, to compile the latest stable version of the R language, do:

 rcompiler()

Regardless of your GNU/Linux distribution and what version of R is in your repositories, you can have the latest stable version of the R language compiled into your computer architecture.

You can use the rcompiler() function to compile different versions of R. For example, running rcompiler(x = "3.6.3") and rcompiler() will install versions 3.6.3 and 4.0.0 on its GNU/Linux distribution, respectively. If you are in version 4.0.0 of R and run the code rcompiler(x = "3.6.3") again, the function will identify the existence of version 3.6.3 in the system and give you the option to use the binaries that were built in a previous compilation. This avoids unnecessarys compilations.

In addition to the x argument, the rcompiler() function has two other arguments that will allow you to change and pass new compilation flags. Are they:

  1. with_blas: This argument sets the --with-blas flag in the R language compilation process and must be passed as a string. Details on the use of this flag can be found here. If with_blas = NULL (default), then it will be considered:

    ./configure --prefix=/opt/R/version_r --enable-memory-profiling --enable-R-shlib
     --enable-threads=posix --with-blas="-L/opt/OpenBLAS/lib -I/opt/OpenBLAS/include
     -lpthread -lm"

    Most likely, you will have little reason to change this aprgument. Unless you know what you're doing, consider with_blas = NULL. Do not change the installation directory, that is, always consider --prefix = /opt/R/version_r, where version_r is a valid version of R. For a list of valid versions of R, run the last_version_r(). Installing R in the /opt/R/version_r directory is important because some functions in the package require this. Both the R language and the OpenBLAS library will be installed in the /opt directory. If this directory does not exist in your GNU/Linux distribution, it will be created;

  2. complementary_flags: String (complementary_flags = NULL by default) for adding complementary flags in the R language compilation process. Passing a string to complementary_flags will compile it in the form:

    ./configure --with-blas="..." complementary_flags

Examples

# rcompiler()