Software installation

We will use R and RStudio in the course. R is the statistics program itself; RStudio is a front end to R and in practice we will use R via RStudio.

Please make sure that you have installed R and RStudio before the first course day. Please read this instruction BEFORE doing any installation; particularly on Windows where a non-standard installation path is recommended.

For Windows users

  1. Download the R installer from https://cran.r-project.org/bin/windows/base/ (large link on top of page), and run it with the modifications described below.

  2. Download the RStudio installer from RStudio’s website (choose the Windows installer in the top link on the list), and run it with the modifications described below.

At the time of writing the installers are called RStudio-2022.02.1-461.exe and R-4.1.3-win.exe but the version numbers may have changed when you read this.

Some users do not have full administrative rights to install software on their computer, and this means that they may encounter problems when trying to install R and RStudio in the standard location on the computer which is C:\Program Files on an english version of windows and c:\Programmer on a danish windows version.

To overcome this potential problem we strongly recommend that everybody do as follows:

Double click on the R installer. During the installation process you will be asked where to install R. Instead of simply accepting the suggested location, please enter:

c:\programs\R

Other than that, just accept anything the installer suggests.

Likewise when installing RStudio. Instead of accepting the suggest location, please enter:

c:\programs\RStudio

Other than that, just accept anything the installer suggests.

After completing these steps you will have icons for R and RStudio on your desktop, and you are good to go.

In some rare cases where things get misconfigured you may experience that R packages are being installed in a directory that is either on a network drive (which is very bad) or e.g. copied to the cloud with OneDrive or similar (which is wasteful). In that case the following command may be useful (only run if instructed to do so):

cat('R_LIBS_USER="C:/programs/R/%p-library/%v"\n', append = TRUE, file = "~/.Renviron")

For mac users

  1. Download the R installer from https://cran.r-project.org/bin/macosx/ (note the different versions depending on you Mac).

  2. Download the RStudio installer from RStudio’s website (choose the Mac OSX installer in the second link on the list).

At the time of writing the installers are called RStudio-2022.02.1-461.dmg and R-4.1.3.pkg for any Mac with a resonably new version of OSX. There are also links for old versions of OSX if you should need it. Note: The version numbers may have changed when you read this.

First install R (the default options are fine). Afterwards install RStudio (again the defaults are fine).

For linux users

R is usually available in the package manager. In debian based distros such as Ubuntu and Linux Mint you simply need to install the package r-base.

Afterwards download and install the appropriate RStudio package from RStudio’s website. At the time of writing the relevant packages are rstudio-2022.02.1-461-amd64.deb (for 64 bit Debian, Ubuntu, Linux Mint and friends) and rstudio-2022.02.1-461-x86_64.rpm (for 64 bit Fedora, RedHat, openSUSE and friends).