Meet the data (and Git)

Research Methods — Week 1 Application

Welcome back

Today’s goals

By the end of this session, you will have:

  1. Loaded real UK energy data in WebR
  2. Made your first plots of the biomass story
  3. Set up your personal GitHub repo
  4. Committed your first .R file

Questions?

Submit questions anonymously:

PollEv.com/geol

text geol to 07480 781235

The biomass question

“Is UK biomass electricity carbon-neutral?”

This week: explore the data. Get a feel for the numbers.

Next week: make proper figures and start making the case.

First steps in WebR

🎓💻 Guided walkthrough

Open the course page

🖥️ Navigate to the Week 1 exercise page

Everyone should see the WebR editor.

Loading the data

elec <- read.csv("data/uk_electricity.csv")
head(elec)
  • What are the columns?
  • What years does it cover?
  • What units are used?

Your first plot

plot(elec$year, elec$biomass_twh,
     xlab = "Year", ylab = "TWh",
     main = "UK biomass electricity generation")

“What’s the first thing you notice?”

Independent exercises

✏️💻 Exercises 1–4

Work through the exercises

The WebR page has scaffolded exercises with hints.

Aim for at least exercises 1–3:

  1. Plot biomass generation over time
  2. Add coal to the same plot — what do you see?
  3. Calculate mean and SD of biomass for the last 5 years
  4. What fraction of UK electricity was biomass in the most recent year?

Finished early? Try the extension exercises.

Git

📋🎓💻 Setting up your repo

Why Git?

Your code needs to be:

  • Saved — not just in the browser
  • Versioned — so you can go back if something breaks
  • Visible — so your demonstrator can see your progress

Git does all three. GitHub Desktop makes it painless.

The workflow

Every session:

  1. Open GitHub Desktop
  2. Pull any changes
  3. Do your work in .R files
  4. Commit with a message
  5. Push

That’s it.

Two clicks and a sentence.

Your commit history becomes your learning record.

Live demo

🖥️ Switching to GitHub Desktop

  1. Clone your personal repo (from GitHub Classroom link)
  2. Open the folder — see the starter files
  3. Create week1.R — paste your WebR code
  4. In GitHub Desktop: see the change → commit → push

Your turn

✏️📋 Clone, commit, push

Do it yourself

  1. Clone your personal repo via GitHub Desktop
  2. Create week1.R — paste your best code from WebR
  3. Commit with a descriptive message
  4. Push to GitHub

Raise your hand when you’ve pushed successfully.

Discussion

💬 What did you find?

What did the data show?

“What did you find in the data?”

  • Biomass has grown rapidly
  • Coal has collapsed
  • Biomass is now a significant fraction of UK electricity

One more question

“If biomass is counted as zero-carbon, what happens to the UK’s official emissions figures?”

We’ll dig into this next week.

Wrap-up

Before you leave

Next time: “What do the numbers say?”

You’ll learn ggplot2 and start asking: “Is that a big number?”