UCD crest Ecological Modelling logo

A sample of tutorials demonstrating data analysis in R

Getting Started

Starting Data Analysis

Data files

Here is an overview of the datasets used in these worksheets divider

To install R

The homepage for downloading the latest R software is http://cran.r-project.org/.

Below we provide shortcuts directly to the installer files for Windows, Mac and Linux operating systems. If the downloads are slow you can select your nearest mirror site from this list

R for Windows

The installer for the latest version of R for Windows can be downloaded from http://cran.r-project.org/bin/windows/base/. The latest version will runon Windows XP and later (including 64-bit versions of Windows).

R for Mac

The installer package for the latest version of R for Macs can be downloaded from http://cran.r-project.org/bin/macosx/.

R for Linux

To install on a Linux machine go to http://cran.r-project.org/bin/linux/ and select your distribution of linux from the list. Installation instructions for each Linux ditribution can be found in a README file.


To install RStudio

Rstudio is a user interface for R that has a free open source version available for Windows, Mac and Linux operating systems.

To install RStudio go to https://www.rstudio.com/products/rstudio/download/ and select the installer for your operating system under the "Installers for Supported Platforms" section. To complete the installation, save and open the installer and follow the installer's instructions.


To install a package for R

The taught modules require three packages to be installed that do not come with R's base distribution: ggplot2, tidyr and emmeans. Here we describe how to install ggplot2. The other packages can be installed using the same approach.

ggplot2 is a graphics package for R that adds to R's built-in graphical functions.

There are two ways to install ggplot2.

Method using RStudio

Follow steps 1-4 (see image below)

  1. Open RStudio, click on the Packages tab in the bottom right panel
  2. click on the install icon
  3. type "ggplot2" in the dialogue box underneath "Packages (separate multiple with space or comma)"
  4. click the install button

Method using just R

Open R and in the console window type