...
Get the R source from https://cran.r-project.org/ under "R source" link on the left panel.
Code Block language bash firstline 1 title Download R source on Ubuntu linenumbers true wget https://cran.r-project.org/src/base/R-3/R-3.5.0.tar.gz
Unpack the zip file:
Code Block language bash firstline 1 title Unzip linenumbers true tar -xf R-3.5.0.tar.gz
Compile the source code:
Code Block language bash firstline 1 title Compile linenumbers true ./configure make
Then check the built system works correctly by
Code Block language bash firstline 1 title check linenumbers true make check
Then install
Code Block language bash firstline 1 title install linenumbers true sudo make install rhome=/usr/local/R/R-3.5.0
Make link for R <major>.<minor>
Code Block language bash firstline 1 title make link linenumbers true sudo ln -s R-3.5.0 R-3.5
Update the alternatives for R:
Code Block language bash firstline 1 title update alternatives linenumbers true sudo update-alternatives --install /usr/local/bin/R R /usr/local/R/R-3.5/bin/R 50 --slave /usr/local/bin/Rscript Rscript /usr/local/R/R-3.5/bin/Rscript sudo update-alternatives --set R /usr/local/R/R-3.5/bin/R # to view all alternatives update-alternatives --config R # to fix broken links yes '' | sudo update-alternatives --force --all
...