Templates & Tools

Learn R Interactively — Directly in the R Console with swirl and DSBswirl

swirl is an R package that provides interactive learning courses directly in the R console. Students can practice R commands at their own pace and receive immediate feedback – without leaving the R environment.

The DSBswirl package contains swirl courses specifically developed for the Data Science in Biology course series. The courses are aligned with the lecture content and are ideal for preparation and review.

Available DSBswirl Courses

German Courses

Course Topic Accompanies No. of Lessons
DSB-01 R Basics DS 1 16
DSB-02 Data Exploration with R DS 1 8
DSB-03 Data Wrangling and Tidyverse DS 1 7
DSB-04 Data Visualization with ggplot2 DS 1 16
DSB-05 Handling Special Data Types DS 1 7
DSB-06 Advanced R Programming DS 3 6

English Course

Course Topic No. of Lessons
Data analysis with R Fundamentals, Tidyverse, Visualization, Linear Regression 16

Installation on Your Own Computer

TipNote

Both packages are already pre-installed on our Posit Workbench!

1. Install the Packages

# Install swirl (if not already installed)
install.packages("swirl")

# Install DSBswirl (from GitHub)
if (!require("remotes")) install.packages("remotes")
remotes::install_github("uham-bio/DSBswirl")

2. Install DSBswirl Courses

library(DSBswirl)

# Install all courses
DSBswirl::install_dsb_courses()

On success, you will see | Course successfully installed! for each of the 6 courses.

Starting Courses

# Start swirl
library(swirl)
swirl()

You will be asked for a freely chosen name — this allows you to resume unfinished lessons later.

Controls During Lessons

Input Description
swirl() Start swirl and select a course
... + ENTER Display next text section
skip() Skip the current question
play() Experiment freely in R
nxt() Return to the lesson after play()
main() Return to the main menu
bye() Save progress and exit
info() Display these options
Esc Leave swirl at any time

A lesson typically takes 10–20 minutes. You can interrupt at any time — the next time you start, you will continue where you left off.

TipTip

After starting swirl(), select the desired course from the list. You can interrupt anytime with bye() and continue later from where you left off.

Further Resources


RLab Courses

As part of the Teaching Lab RLab (Universitätskolleg 2.0, funded by the BMBF 2017–2019), additional swirl courses were developed for Biology, Geography, and Meteorology. All courses can be used independently and for self-study.

Biology

Course Language Download
Data Analysis with R — accompanying the course Data analysis with R (IMF, UHH) EN 📦 .swc
Statistik & Programmierung mit R — former BSc course BMARSYS-6 (Marine Ecosystem and Fisheries Sciences) DE 📦 .swc
Datenaufbereitung mit tidyr — Marine Ecosystem and Fisheries Sciences DE 📦 .swc
Daten visualisieren mit ggplot2 — Department of Biology DE 📦 .swc

Geography & Meteorology

Course Subject Download
R Grundlagen Geography 📦 .swc
Daten einlesen und kennenlernen Geography 📦 .swc
Deskriptive Statistik mit bodenkundlichen Daten Physical Geography 📦 .swc
Deskriptive Statistik Geländeklimatologie Physical Geography 📦 .swc
Datenhandling und Visualisieren von Klimadaten Meteorology 📦 .swc
Deskriptive Statistik und Vergleiche meteorologischer Zeitreihen Meteorology 📦 .swc

The RLab courses are installed locally via an .swc file using the install_course() function. The .swc file extension is also used by Adobe in connection with the multimedia platform flash. The .swc RLab files (swirl course) are unrelated; opening them with Adobe software (if installed on your computer) will not work.

To download the course files, right-click and select ‘Save target as…’.

Then enter the following command in the R console and press Enter:

install_course(swc_path = "/file-path/filename.swc")

You should now see | Course successfully installed! in the console.

The RLab project was funded from 2017–2019 as a Teaching Lab of the Universitätskolleg 2.0 at the University of Hamburg (BMBF 01PL17033). Project lead: Prof. Jürgen Böhner; conceptual development: Niels Schwab. Contributors included teachers from Geography, Meteorology, Biology, and Marine Ecosystem Sciences as well as student research assistants.

rlab.blogs.uni-hamburg.de