Download R Source code from
https://cran.rstudio.com/index.html
extract the .tar.gz file to a location
gzip -dc R-x.y.z.tar.gz | tar -xf -
current sources for the recommended packages, which can be obtained by rsync or downloaded from CRAN. To use rsync to install the appropriate sources for the recommended packages, run ./tools/rsync-recommended from the top-level directory of the R sources.
Install necessary packages to add repository over HTTPS
sudo apt install apt-transport-https software-properties-common
Add CRAN external repository
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'
edit /etc/apt/sources.list and remove comments for deb-src for line containing cran35/
(mostly last line of this file)
execute sudo apt-get update to read the sources files.
Install package dependencies using
sudo apt-get build-dep r-base
This step will download a tone of dependencies and may take some time
Now navigate to folder where R is extracted and execute
./configure --prefix=/opt/R/3.6.2 --enable-R-shlib --with-blas --with-lapack
This prepares a make file that installs R under /opt
blas enables to use system libraries rather than R internal libraries. It improves analytics calculation speed.
Output should look like something like this
Execute make comment to execute it
make
finally install it by
sudo make install
you can optionally create a short cut for it using
sudo ln -s /opt/R/3.6.2/bin/R /bin/R
Comments