Open-source interactive self-paced R learning website

👩🏻‍💻 Danyang Dai @ University of Queensland

  • Mitchell O’Hara-Wild @ Monash University
  • danyang.dai@uq.edu.au
  • Emi Tanaka @ Australia National University
  • https://dai.netlify.app/




















15th of Decemeber OZCOST 2023

Acknowledgement of Country



I acknowledge the Traditional Owners and their custodianship of the lands on which we meet.
We pay our respects to their Ancestors and their descendants, who continue cultural and spiritual connections to Country.

Has this happened to you before?

Ideally, we would like to teach students read in a dataset and have a look at the structure of the data.

library(tidyverse)
crabs <- read_csv("data/australian-crabs.csv") 
str(crabs)
spc_tbl_ [200 × 8] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
 $ species: chr [1:200] "Blue" "Blue" "Blue" "Blue" ...
 $ sex    : chr [1:200] "Male" "Male" "Male" "Male" ...
 $ index  : num [1:200] 1 2 3 4 5 6 7 8 9 10 ...
 $ FL     : num [1:200] 8.1 8.8 9.2 9.6 9.8 10.8 11.1 11.6 11.8 11.8 ...
 $ RW     : num [1:200] 6.7 7.7 7.8 7.9 8 9 9.9 9.1 9.6 10.5 ...
 $ CL     : num [1:200] 16.1 18.1 19 20.1 20.3 23 23.8 24.5 24.2 25.2 ...
 $ CW     : num [1:200] 19 20.8 22.4 23.1 23 26.5 27.1 28.4 27.8 29.3 ...
 $ BD     : num [1:200] 7 7.4 7.7 8.2 8.2 9.8 9.8 10.4 9.7 10.3 ...
 - attr(*, "spec")=
  .. cols(
  ..   species = col_character(),
  ..   sex = col_character(),
  ..   index = col_double(),
  ..   FL = col_double(),
  ..   RW = col_double(),
  ..   CL = col_double(),
  ..   CW = col_double(),
  ..   BD = col_double()
  .. )
 - attr(*, "problems")=<externalptr> 

Has this happened to you before?



library(tidyverse)
crabs <- read_csv("data/australian-crabs.csv") 
str(carbs)
Error in str(carbs) : object 'carbs' not found

Has this happened to you before?



library(tidyverse)
crabs <- read_csv("data/australian crabs.csv") 
Error : 'data/australian crabs.csv' does not exist in current working directory ('/Users/s4775530/Github/LearnR_OZCOTS_2023_presentation').

Has this happened to you before?



library(tidyverse)
crabs <- read_csv("data/australian-crabs.csv") 
Error in read_csv("data/australian-crabs.csv") : 
  could not find function "read_csv"
  • And many more unexpected errors!


errors


😠💥 ❗

It is ok to make mistakes

  • “Great teachers make it safe to be wrong. They build a Culture of Error that respects, normalizes,and values learning from errors.” by Doug Lemov and Norman Atkins from Teach Like a Champion 2.0.

  • Studies1 have suggested that students learn more during debug session compared to error-free lecture.

Understanding error code

library(tidyverse)
str(carbs)
Error in str(carbs) : object 'carbs' not found


library(tidyverse)
crabs <- read_csv("data/australian-crabs.csv") 
Error in read_csv("data/australian-crabs.csv") : 
  could not find function "read_csv"


crabs %>% 
  mutate(female = ifelse(sex == "Famle",1,0)))
Error: <text>:2:48: unexpected ')'
1: print(try(crabs %>% 
2:   mutate(female = ifelse(sex == "Famle",1,0)))))
                                                  ^
  • Check spelling
  • Syntax missing ( or ) or { or } etc.
  • Loading required packages
  • Search and Google the messages
  • Turn it on and off again 👼

It is okay to ask question, but where 😕

It is okay to ask question, but how 😕

QUESTION

Minimal reproducible examples

  • Does your error relate to dataset? Provide minimal datasets

  • Provide minimal code (not just a screenshot)

  • Provide session information using sessioninfo::session_info()

  • Using the reprex package for producing examples

Saving more time in classroom

More to LearnR website

Did it work?

Acknowledgement


Dr. Emi Tanaka 📧 emi.tanaka@anu.edu.au


Mitchell O’Hara-Wild 📧 mitch.ohara-wild@monash.edu.au


Dr. Jessica Leung 📧 Jessica.Leung@monash.edu

Resources and future work

  • danyangdai.github.io/LearnR_OZCOTS_2023_presentation/
  • github.com/DanyangDai/LearnR_OZCOTS_2023_presentation
  • learnr.numbat.space
  • Collaborate at: github.com/numbats/learnr

Danyang Dai 📧 danyang.dai@uq.edu.au

Dr. Emi Tanaka 📧 emi.tanaka@anu.edu.au

Mitchell O’Hara-Wild 📧 mitch.ohara-wild@monash.edu.au