Getting Started

A five-minute introduction to how these tutorials work

Introduction

This tutorial teaches you the mechanics of working through a learnr2 tutorial — not R itself. It is meant to be the first tutorial you ever complete, before any that actually teach R.

There are three steps to every tutorial: tell us who you are, work through the exercises, and download your answers when you are done. This one is no different, and should take about five minutes.

A learnr2 tutorial runs entirely in your web browser using Quarto and WebR (R compiled to WebAssembly). There is no separate R or RStudio installation to set up, and no server involved — the code cells on this page run right here as you work through them.

Start with your name and email below. (Your instructor might also ask you to fill in the “ID” field so your work can be matched to a grading roster; if not, just leave it blank.) Fill in the fields and click Submit — and don’t worry about getting it exactly right the first time: your answers save automatically as you type, and clicking back into a field and changing it updates what’s saved, mistakes included.

Student Information

Running R Code

Every learnr2 tutorial has cells like the one below, where you write and run R code right here in your browser, alongside prose questions like the “Submit Answer” one you just used for your name and email.

Exercise 1

If you were sitting at a real R console, one of the first things worth trying is getwd(), which asks R “what folder are you currently working in?” Type getwd() into the cell below and click Run Code.

getwd()

You should see a path appear below the cell, something like [1] "/home/web_user". That’s not a folder on your own computer — WebR runs inside a small virtual file system that lives entirely in your browser, so don’t worry if your path looks different from a friend’s. What matters is that a real command produced a real result, right here, with nothing to install.

Now answer the question below: paste in both the code you ran and the result it printed. Get in the habit of copying both the command and its response together whenever a tutorial (or a colleague) asks what happened when you ran something — one without the other is only half the story.

Exercise 2

Every answer on this page, including the one you just gave, is saved to your browser as you go — not only once you finally download your work. To see this for yourself: reload this page right now. Your name, email, and the answer above should all still be there, exactly as you left them.

This is also why there’s a Start Over button at the bottom of the sidebar rather than relying on a plain reload to clear things: reloading on its own does not erase anything, on purpose, so you can close a tutorial partway through and pick it up again later without losing progress. Only Start Over does that, and only after asking you to confirm.

Exercise 3

Not every answer is text. Run the code below — it draws a simple plot — then take a screenshot of it (e.g. Cmd+Shift+4 on a Mac, Win+Shift+S on Windows, or your Chromebook’s screenshot tool) and paste it directly into the question underneath: click into the response box and press Ctrl+V (or Cmd+V). There’s no upload button; pasting is the whole mechanism.

Your Answers

At the end of every tutorial, you will save your work (and submit it, at your instructor’s discretion). First, answer the question below about how many minutes you spent on the tutorial. Then click the button below that to gather every answer on this page into a single file and download it.

The downloaded file’s name will start with getting-started, followed by a timestamp, and will be saved wherever your browser saves downloads. Unless your instructor tells you otherwise, send them this file as-is (for example, attached to an email or uploaded to your course’s learning management system).

Summary

That’s the whole workflow: tell us who you are, work through the exercises — running code, answering prose and quiz questions, all of it saved automatically as you go — and download your answers when you’re done. Every other learnr2 tutorial you take follows the same three steps; only the R content in the middle changes. Good luck!