R for Marine Scientists
A hands-on tutorial using real whale survey data
🐋 R for Marine Scientists
A five-module, hands-on introduction to R programming using real-world whale survey data. No prior coding experience required.
Welcome
This tutorial teaches you to use R and RStudio for data analysis in the context of marine biology. By the end you will be able to import messy field data, clean and reshape it with the tidyverse, create publication-quality figures with ggplot2, and write reproducible reports with R Markdown — all skills immediately applicable to cetacean research.
Each module builds on the previous one and uses the same real dataset throughout.
Modules
Install R and RStudio, navigate the IDE, understand the console and script editor, and run your first lines of code.
Arithmetic, variables, data types, vectors, functions, and control flow — the building blocks of every R program.
Read CSV survey data, clean column names, filter, mutate, and summarise with tidyverse packages.
Plot survey data using the ggplot2 package.
Weave code, results, and prose into polished HTML and PDF reports that update automatically when data changes.
Prerequisites
| You need | Notes |
|---|---|
| A computer (Windows, macOS, or Linux) | Admin rights to install software |
| R ≥ 4.3 | Download from CRAN |
| RStudio ≥ 2023.12 | Download from Posit |
| Internet connection | For installing packages |
No prior programming experience is assumed.
How to use this site
- Work through modules in order — later modules assume earlier knowledge.
- Every code block can be copied with the clipboard icon at the top right.
Tip: Keep an RStudio project open alongside this site and paste code into your own scripts as you read. Active practice is the fastest way to learn R.