NZILBB R, Stats, and Open Science Workshops

Author

Joshua Wilson Black

Published

April 2, 2026

Introduction

This online book contains material for NZILBB’s R, Stats, and Open Science workshops. The workshops began late in the first semester of 2024. As time goes on, this book will expand in both content and contributors.

Sessions in Semester 1, 2026

In Semester 1, 2026 we’ll be looking at Bayesian methods.

All sessions will be held in the Brain Box, Elsie Locke 203 on Wednesday at 12pm.

Announcements are made on the NZILBB Rocket Chat in the #r-stats-open-sci-workshops channel. If you don’t know how to access this, email me at .

One-on-one help

For UC students and staff, I am happy to talk over any issues you have with this material. Please get in touch with me at .

If you have found your way to this material by some other means, you can also email me!

NZILBB induction

The following steps are a very quick guide to getting up and running for quantitative analysis with R, along with the wider Open Science infrastructure at NZILBB. Some of these steps are discussed at greater length elsewhere.

If you have any troubles with any of the steps, let me know!

  1. Install R and R Studio, following the steps here: https://posit.co/download/rstudio-desktop/ or using “UC Self Service” on a UC managed-Mac or “Companty Portal” on a UC-managed Windows computer. If using a UC-managed Windows computer, also install RTools from the same source.

  2. Open RStudio, type install.packages('usethis') into the ‘Console’ (at the bottom left of RStudio) and press enter/return.

  3. Install Git.

    • For Windows: download from https://git-scm.com/downloads/win. If you are given an option to allow ‘3rd-party software’ say yes.
    • For macOS: install developer tools by opening the Terminal app and typing xcode-select --install.
    • For Linux: odds are you have it already, but here’s a list of terminal commands to install it for different versions of Linux: https://git-scm.com/downloads/linux.
  4. Create accounts at https://github.com and https://osf.io.

  5. Connect R and GitHub.

    • Restart RStudio.
    • Write usethis::use_git_config(user.name="YOUR NAME", user.email="YOUR GITHUB ACCOUNT'S EMAIL ADDRESS") in the console and press enter/return. Replace YOUR NAME and YOUR GITHUB ACCOUNT'S EMAIL ADDRESS with your name and the email you used to sign up to GitHub.
    • Write usethis::git_default_branch_configure() in the console and press enter/return.
    • Write usethis::create_github_token() in the console and press enter/return.
      • This will open a browser window where you will log in to your GitHub account. Accept the default options (click ‘Generate Token’) and copy the token which appears (don’t close the window until you’re finished the next step).
    • Write gitcreds::gitcreds_set() in the console and press enter/return.
      • Paste the token in after Enter password or token:.
  6. University of Canterbury staff and students: ensure you can log in to the UC GitLab at (use your UC log in and password): https://eng-git.canterbury.ac.nz/

  7. Optional: Install GitKracken: https://www.gitkraken.com/

Other resources

You may find the following links profitable: