Skip to main content

Setup

Here are the course set up instructions - if you are able to do this before the course, that would be wonderful! But don’t worry too much if you can’t.

There are essentially three parts:

  1. Install R and some packages
  2. Download the code
  3. Check it worked.

What to install

R, and an editor

You need R 4.1.0 or later, from https://cran.r-project.org/. Check what you have with:

R.version.string

You also need an editor. I recommend either

Both come with Quarto, which renders the report at the end of the pipeline. If you use something else, install Quarto as well.

The R packages

This takes a few minutes:

install.packages(c(
  "conflicted",
  "fs",         
  "janitor",    
  "quarto",     
  "tarchetypes",
  "targets",
  "tidyverse",  
  "usethis",    
  "visdat",     
  "visNetwork"  
))
ImportantRestart R after a big install

If you install a package already in use in that session, R can get a bit stuck.

Once the installation is done, I recommend you restart R.

In RStudio, that’s Ctrl + Shift + F10 on Windows, or Cmd + Shift + 0 on a Mac.

Download the code

…here’s one I prepared earlier

We will be working with a given set of code that I

usethis::use_course("njtierney/citywalk")

It asks where to put the folder, downloads it, and opens it as a project. It’s a small download.

citywalk is where we start: a script, the data, and a couple of functions. Its README says what everything is.

Check it worked

Open the citywalk project, then run:

pkgs <- c(
  "conflicted", "fs", "janitor", "quarto", "tarchetypes", "targets",
  "tidyverse", "usethis", "visdat", "visNetwork"
)

sapply(pkgs, requireNamespace, quietly = TRUE)

quarto::quarto_version()

Every package should say TRUE, and the last line should print a version number.

Then open explore.R and run it from start to finish.

You should get two plots and a small table.

If something won’t install, that’s OK!

Installation problems are faster to fix with two people - I’m happy to help you on the course day.

How we will work

During the course, I will be presenting content and live-coding. We will take it in turns - my turn, then your turn.

Don’t worry too much about typing along with me - although you are welcome to.

Each exercise will start from a checkpoint, which is a copy of the code at that point in the workshop.

If you fall behind, or your code is in a state, you can pick up from the checkpoint and carry on - for example, going from checkpoint 2, you would run:

usethis::use_course(
  "https://github.com/njtierney/citywalk/archive/refs/heads/checkpoint-2.zip"
)

These checkpoints will be provided at the relevant part in the book.

The boxes

  • ✏️ Your Turn: something for you to do.
  • 🔎 Going deeper: An (optional) extra detail.
  • ⚠️ Watch out: a common trip point.
  • 🚨: something that might be more annoying than tripping.

Where everything lives

If you find a mistake, I’d love to know about it!

You can open an issue on github - each page has a link to do this.

Links