A.1 Installing a Package

The easiest way to install an R Package is to use the RStudio tab “Packages”:

Install packages via RStudio GUI

Figure A.1: Install packages via RStudio GUI

  1. Click on the “Packages” tab

  2. Click on “Install” next to Update

  3. Type the name of the package under “Packages, in this case type ggplot2

  4. Click “Install”

This will search for the package “ggplot” specified on a server (the so-called CRAN website). If the package exists, it will be downloaded to a library folder on your computer. Here R can access the package in future R sessions without having to reinstall it.

An other way is to use the install.packages function. Open R (if already opened please close all projects) and type the following at the command line:

If you want to install a package directly from github, the package “devtools” must be installed first: