Setup

Before You Start

Applied R introduces programming from the beginning across eight lessons. Each lesson is planned for 100 minutes, including a 10-minute break. You should be comfortable creating folders and locating files, but no previous R experience is required. Prepare the software and data below before the first session.

Install compatible versions of the following on your computer, using your organisation’s software arrangements on a managed device:

  1. the R software itself, and
  2. RStudio Desktop.

If you already have R and RStudio working, use the checks below rather than reinstalling them. If installation is unavailable, tell the organiser before the session so that an appropriate shared-screen or supported-environment fallback can be arranged.

Create a Project and Obtain the Data

  1. Create a folder called applied_R in a location you can find again.
  2. In RStudio, create a project in that existing folder (File > New Project > Existing Directory). See the official Projects guide.
  3. Create a data folder inside the project.
  4. Download gapminder_data.csv into data. This is a CSV file, so it does not need unzipping.
  5. Create and save an R script in the project folder. The loops and tidyverse lessons also use data supplied by the gapminder package.

Prepare the Lesson Packages

Lesson 4 uses gapminder, dplyr and readr. Installing tidyverse supplies those packages and tidyr for lessons 5 and 6.

Run this once in the R console if these packages are not already available:

install.packages(c("gapminder", "tidyverse"))

The retained examples in lesson 5 and lesson 6 also use the following packages. Prepare them before those lessons:

install.packages(c("rmarkdown", "openxlsx", "gridExtra", "ggExtra", "knitr"))

Package installation needs network access. If you see an error, retain the message and ask the organiser which environment or installation route to use. Install packages once; load them again when starting a new R session.

Check Your Setup

With the applied_R project open, run:

library(gapminder)
library(tidyverse)

file.exists("data/gapminder_data.csv")
head(gapminder::gapminder)
sessionInfo()

The file check should return TRUE, and the dataset should print without a package error. If the file is missing, check getwd() and the location of the downloaded CSV. Keep sessionInfo() with any request for help so that the R and package versions are visible.

The iteration and data-analysis sessions create an output folder for derived files. Keep the course input file unchanged and inspect output destinations before rerunning file-writing examples. The complete course contains eight lessons; the former variables page is now lesson 2 on research data.

Prepare the Shared Project for Lessons 5–8

Download research-project.zip, extract it and open the extracted research-project folder as an RStudio project. Keep the structure intact: analysis.R, report.qmd, app.R, tests.R, the README and data/gapminder_data.csv belong together. The CSV is a copy of the existing public historical teaching data.

Check from that project’s R console:

source("analysis.R")
dat <- read_research_data()
nrow(select_observations(dat, c("Ireland", "Brazil"), 2007))

The selection should contain two observations. Once Shiny is available, use source("tests.R") to check the complete shared project, including reactive inputs. Do not run the app in the same session while those server tests run.

Digital Notebook and Dashboard Access

For lesson 7, install the Quarto CLI if it is unavailable in RStudio. Check quarto --version in a terminal, then open report.qmd and use Render. The report needs knitr and rmarkdown; HTML output avoids requiring a PDF/LaTeX installation.

For lesson 8, install Shiny if needed:

install.packages("shiny")

With the extracted project open, run shiny::runApp("."). Country/year controls, a figure and table should appear in a browser. Keep the R process running and use Stop/Esc to finish. Install software before class; use a partner’s screen or instructor demonstration if access fails. No paid hosting account is required for the local exercises.

Use Shiny’s getting-started guide for further help. A rendered report and a live Shiny service have different sharing requirements; deployment is outside classroom setup.

After Setup

Start with session 1: R Foundations. The learner Additional Material page provides a Gapminder practice workflow and further references. Use Digital Skills Clinics for follow-up help with a specific R or data task.

Course Navigation

Course Overview · Setup · Additional Material · Reference · Discussion