How to install tar.gz file directly from URL efficiently from terminal?
If you don't want to keep the tar file, do

curl https://cran.r-project.org/src/base/R-3/R-3.5.0.tar.gz | tar zxf -


This uncompresses and extracts the tar file while downloading it.

The commands to install vary with the package, but you can do this after the download has finished:

cd R-3.5.0 ; ./configure &amp;&amp; make