Chapter 2 Installation

The primary source of information about R and to download the software itself is the R Project website. The website provides information about the people behind R, news, upcoming events, links to manuals, where to download R, and much more.

(Don’t be distracted by the very plain web design of that page. The R Core Team consists of volunteers who focus on developing the language and prefer a web page that is easy to maintain for them.)

2.1 Installing R

The software (R and additional packages) are distributed via the so called Comprehensive R Archive Network (CRAN) availble via https://CRAN.R-project.org/ where you will find links to download R for linux, OS X, and Windows.

Main page of the Comprehensive R Archive Network website [CRAN.R-project.org/](https://CRAN.R-project.org/).

Figure 2.1: Main page of the Comprehensive R Archive Network website CRAN.R-project.org/.

Deppending on your operating system:

  • Windows: Download and install the latest base R version (.exe) from CRAN (same for both, 32/64 bit Windows versions). Furthermore, download and install the Rtools (recommended version).
  • Mac OS X: Download and install the latest base R version (.pkg) from CRAN (e.g., R-3.6.1.pkg). Furthermore, download and install the latest clang and gfortran compilers (which can be found under tools).
  • Linux: Download and install the latest base R version via the Linux package manager (r-base which consists of r-base-core and r-base-devel) or follow the instructions on CRAN. Binaries in various flavours (.deb, .rpm) are available on CRAN.

Note: The compiler tools (Rtools on Windows; clang/gfortran on OS X) are needed for installing additional source packages which require compilation (contain C or Fortran code). This is not immediately important, but it is highly recommended to install them alongside with base R as you will quite likely need it in the future.

The basic R installation comes with a command line interface (CLI), possibly enhanced by some limited graphical user interface (GUI) capabilities on Windows and Mac. The CLI is basically all you need, and if you are a command line enthusiast - that’s it! However, for this course we will use the integrated development environment RStudio, which is introduced next.

2.2 Install RStudio (IDE)

To make things easier, especially for beginners, we will use graphical interface, a so called “integrated development environment” (IDE). Several IDEs for R exist such as e.g., the R commander, RGui, or also RStudio which we will use in this course.

RStudio is free to use and open source (but developed and maintained by a private company) and is available for all common operating systems (MS Windows, Mac OS X, Linux). To install, visit https://posit.co/download/rstudio-desktop/ and download the free RStudio Desktop version which fits your operating system. For linux users: RStudio is typically also available via package manager (apt, yum, …).

2.3 Starting RStudio

After you have successfully installed R base, the R tools, and Rstudio, you should now be able to start RStudio via “Programs” or a desktop icon. Note: Depending on your OS there might also be a “R commander” icon under programs or on your desktop, however, we are looking for this now:

After starting this application you should see a window which looks similar to the following and you are ready to start:

An example how the RStudio IDE looks like. Download via [posit.co/download/rstudio-desktop/](https://posit.co/download/rstudio-desktop/).

Figure 2.2: An example how the RStudio IDE looks like. Download via posit.co/download/rstudio-desktop/.

2.4 Settings

RStudio has, of course, dozens of settings which can be adjusted. We will only hightlight two which may be important:

  • Dark mode: By default, RStudio comes in “black on white” (white background, black text). Some of you may prefer a dark background and white text. You can change this by navigating to: “Tools > Global Options > Appearance > Editor theme” and select one you like more.
  • Auto-complete: By default, the “auto-complete” option is enabled in RStudio. As soon as you open braces in the code editor (e.g., type { or () RStudio will automatically close the braces (adding }, )). Some of you may like it, others may not. You can disable auto-completion by going to: “Tools > Global Options > Code” and uncheck “Insert matching parens/quotes”.