NZILBB R, Stats, and Open Science Workshops
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, 2025
In Semester 1, 2025 I’ll be running sessions on Wednesday (fortnightly) and Thursday (every week). Thursday sessions will alternate between programmed workshops and drop-in sessions. The Wednesday sessions will be a hands-on reading group for more advanced R users.
All sessions will be held in the Brain Box, Elsie Locke 203.
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 joshua.black@canterbury.ac.nz.
Programmed Workshops
Workshop sessions consist of a short presentation and a chance for some hands-on practice. The series as a whole is for complete beginners, but the sessions are cumulative.
If you need to catch up, check out the material in the ‘Foundations’ section of this website and don’t hesitate to contact me for a one-on-one session to discuss any difficulties.
The first session will be on Thurs 20th Feb, at 11am.,
Drop-in Sessions
I will remain in the Brain Box for an hour after the NZILBB research seminar for anyone who wishes to discuss any coding or stats problems.
The first drop-in session will be on Thurs 27th Feb at 11am, with subsequent sessions fortnightly.
Wednesday Sessions
Our theme for this semester will be variable selection in statistical models. Typically, there are many possible variables which we might include in a model. There are many (strong!) opinions about the variable selection process. We’ll look at the options, their pros and cons, and implement them with our own data. This will help you both with your own research and when reading (and peer-reviewing!) other people’s work.
The first Wednesday session will be on Wed 26th Feb at 1pm, with subsequent sessions at the same time fortnightly.
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 joshua.black@canterbury.ac.nz.
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!
Install R and R Studio, following the steps here: https://posit.co/download/rstudio-desktop/ or using the UC Software Centre if you are on a managed UC laptop.
Open RStudio, type
install.packages('usethis')
into the ‘Console’ (at the bottom left of RStudio) and press enter/return.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.
Create accounts at https://github.com and https://osf.io.
- On GitHub, request to join the NZILBB group at https://github.com/nzilbb/.
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. ReplaceYOUR NAME
andYOUR 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:
.
- Paste the token in after
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/
Optional: Install GitKracken: https://www.gitkraken.com/
Other resources
You may find the following links profitable:
- The alternative to data analysis with a programming language is usually some kind of spreadsheet. Here are some spreadsheet horror stories: https://eusprig.org/research-info/horror-stories/.
- Why do we have to learn how to program? Why is science ‘amateur software development’? This is a good lecture on the topic: https://www.youtube.com/watch?v=8qzVV7eEiaI.
- Usually these techniques aren’t explicitly taught. These workshops are our attempt to respond to this problem!
- Why can’t you do data science with a spreadsheet? https://www.youtube.com/watch?v=cpbtcsGE0OA
- These workshops have been heavily influenced by Winter (2019)