...
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