Installing R

Intalling RStudio

For those that want to get a head we recommend the following reads:

A gentle introduction to using R and RStudio

There are miriads of documents on using R and RStudio. While searching the web, the following youtube link serves as good as any other.

Installing packages

Packages (libraries) can be thought of an extensions of the basic R. Packages typically contain a collection of functions or/and data. Although the basic R comes with a number of standard functions and packages they only form a tiny part of the current R-environment.

Generally packages are installed with the following command:

install.packages("packagename")

E.g. if you want to install the package readr one would do:

install.packages("readr")

When you use install.packages function you will see a bunch of text that appears in the console window. If you have installed a package successfully a text near the bottom should state something like:

* DONE (readr)

The downloaded source packages are in
    ‘/tmp/RtmpVpJbb8/downloaded_packages’

If something else appears, then the package most likely did not install successfully. The problems may be:

Trying to decipher the error output that gets printed in the console may be a challenge for the novice.

One normally installs packages only once or when one wants to get the latest update. To see what packages are installed one can use the following function:

installed.packages()

In RStudio one can obtain the same information by opening the “Packages” tab in the lower right window panel.

For the work ahead it is recommended that the following tidyverse packages are installed:

This can be done by typing in the following R-code:

install.packages("tidyverse")

If you don’t get something like:

* DONE (tidyverse)

in one of the bottom lines in the console, then not all packages may have installed. So try as an alternative:

install.packages("ggplot2")
install.packages("tibble")
install.packages("tidyr")
install.packages("readr")
install.packages("dplyr")

Besides the above packages you are advised to install also the following packages:

Installation of other packages may be called for later in this space.