Skip to content

3.3 Lab

Task: install packages from source#

The default mechanism for installing a package on Linux is to compile from source.

Use the R console in RStudio Server Pro to determine your current CRAN repository:



You should get the result that the default repository is the RStudio CRAN mirror:

[1] TRUE

Next, install a package:

install.packages("quantreg", dependencies = TRUE)


Make a note how long this code takes to run.

In addition, note that while the package installs, you get several messages in the console of the form:

* installing *source* package ‘quantreg’ ...
** package ‘quantreg’ successfully unpacked and MD5 sums checked
** libs
f95   -fpic  -g -O2  -c boot.f -o boot.o
f95   -fpic  -g -O2  -c bound.f -o bound.o
f95   -fpic  -g -O2  -c boundc.f -o boundc.o
f95   -fpic  -g -O2  -c srtpai.f -o srtpai.o
gcc -shared -L/opt/R/3.5.1/lib/R/lib -L/usr/local/lib -o boot.o bound.o boundc.o brute.o chlfct.o cholesky.o combos.o crqf.o crqfnb.o dsel05.o etime.o extract.o idmin.o iswap.o kuantiles.o linpack.o mcmb.o penalty.o powell.o quantreg_init.o rls.o rq0.o rq1.o rqbr.o rqfn.o rqfnb.o rqfnc.o rqs.o sakj.o sparskit2.o srqfn.o srqfnc.o srtpai.o -llapack -lblas -lgfortran -lm -lquadmath -lgfortran -lm -lquadmath -L/opt/R/3.5.1/lib/R/lib -lR
installing to /home/jen/R/x86_64-pc-linux-gnu-library/3.5/quantreg/libs
** R
** data
** demo
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (quantreg)

What does all of this mean?

  • Those lines starting with f95 -fpic ... indicates that the Fortran 95 compiler is at work.
  • And the line starting with gcc -shared ... indicates that the GNU C compiler (gcc) is at work.
  • Then you should get some lines starting with ** R that tells you the compilation step is complete, and R is now finalizing the package installation.
  • Once you get * DONE ... you know that package installation is complete.

Configure RStudio Server Pro for binary packages#

You will encounter RStudio Package Manager in a later module in this course. You haven't yet installed RStudio Package Manager, so for now you can use the RStudio demo instance to configure RStudio Server Pro.

Identify the binary package installation URL#

You can browse the demo instance at

Browse to the setup tab, and find the set of buttons that allow you to choose "Source" or "Binary".


Use the drop-down button to select the correct operating system, then copy the URL

Once you have the correct URL, you can configure RStudio Server Pro

Task: Configure RStudio Server Pro#

You can find the instructions for configuring RStudio Server Pro in the RStudio Package Manager admin guide, specifically in section 19.1 A Single Repository.

Read the instructions, then SSH into your VM instance and edit the file


and add the line


Save the file, then restart RStudio Server:

sudo rstudio-server restart

Also restart your R session

  • In RStudio Server Pro, you can restart your R session from the menu at /Session / Restart R, OR
  • Use the keyboard shortcut Shift + Ctrl + F10

Task: Test that it works#

Once you've restarted RStudio Server Pro, use the R console to check that your repository is correct, and that packages install from binaries without compilation.

To do this, repeat the R commands you used earlier:


This time, you should get the URL to the RStudio Package Manager demo site:


Then force the re-install of the quantreg package:


This should be the complete output:

Installing package into ‘/home/jen/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
trying URL ''
Content type 'application/x-gzip' length 1537774 bytes (1.5 MB)
downloaded 1.5 MB

* installing *binary* package ‘quantreg’ ...
* DONE (quantreg)

The downloaded source packages are in

Note that this step is very quick, and there are also no messages from either the fortran compiler (f95) or the C compiler (gcc).

Task: Install the tidyverse#

To speed up the progress of later modules in this course, start the installation of a set of packages you will need later:

  pkgs = c(

This process will take several minutes. Once the installation is running, you can carry on with the rest of the course.