Interactivity and immediate feedback with learnr

rstudio::conf(2022)
Designing the data science classroom

Maria Tackett

What?

Parts of a tutorial

Link to tutorial: minecr.shinyapps.io/dsbox-01-edibnb

Why?

Within a course

  • In a flipped classroom
    • Assign a learnr tutorial that students can practice with before introducing a concept in class
    • Cover the concept in class (quicker)
    • Allocate the time saved to hands on exercises in class
  • As lecture follow-up
    • Provide the same content from the lecture as follow-up exercises
  • Provide immediate and meaningful feedback at scale

Self learning

  • Learn by doing
  • Tutorials in R packages
  • Workshop follow-ups

How?

Topics

  • Question types

  • gradethis for automated feedback

  • Recording student responses using minute papers and learnrhash

  • Sharing tutorials with students

Getting started: Qmd ➡️ Rmd

  • Learnr tutorials are written in an R Markdown document (.Rmd)

  • The syntax and structure is very similar to a Quarto document (.qmd)

  • These documents primarily differ in some arguments in the YAML

YAML for learnr tutorial

---
title: "Learnr Demo"
output: 
  learnr::tutorial:
    progressive: true
    allow_skip: true
    css: "css/style.css" 
runtime: shiny_prerendered
---
  • runtime: shiny_prerendered: Turns R Markdown into interactive app
  • progressive: true: Display one subsection at a time
  • allow_skip: true: Able to skip exercises in a section
  • css: "css/style.css": Apply custom formatting

Demo

Follow along

Follow along options:

Writing questions

  • Question types
    • Multiple choice
    • Coding exercises
    • Sorting questions
  • Automated feedback

Your turn: Writing exercises

RStudio Cloud > “Module 4 - Learnr” > learnr-demo.Rmd > Part 2: Your turn!

Add three questions to the tutorial:

  • one multiple choice
  • one coding exercise
  • one sortable question

Stretch goal: Add hints to the coding exercise.

You can write your questions in Part 2: Your turn! section of learnr-demo.Rmd.

15:00

gradethis

The gradethis package makes it feasible to check coding exercises in a learnr tutorial. There are two basic methods for checking:

  • grade_this_code(): Compare student code to model code (strict check)

  • grade_this(): Compare student result to model result (flexible check)

devtools::install_github("rstudio/gradethis")

Your turn: Writing automated feedback

RStudio Cloud > “Module 4 - Learnr” > learnr-demo.Rmd > Part 4: Your turn!

Add automated feedback to your coding exercise.

Stretch goal: Consider 2 -3 common errors students may make. Write specific feedback for those errors.

You can write your responses in Part 4: Your turn! section or modify the code in Part 2 of learnr-demo.Rmd.

10:00

Recording student responses

“Minute paper”

Add a link to a form at the end of the tutorial for a “minute paper”

  • Write about one or two questions you didn’t get right initially but were able to solve after a few tries. What was difficult about them? What did you ultimately learn?

    OR

  • If you got every single question correct on the first try, write one question you would still like clarified on the topics covered in this quiz.

learnrhash

  • Use the learnrhash package to collect student responses from learnr tutorials.

  • Students submit responses using a “hash” submitted in an online form.

remotes::install_github("rundel/learnrhash")

Sharing with students

  • Deploy on

  • Distribute tutorials as a package

    • Example: dsbox R package includes a set of learnr tutorials

    • More about developing packages in a later session

Learn more!

Creating learnr tutorials

Learn more!

Sharing tutorials

Workshop check in

We have completed Day 01! Please answer the following using your sticky notes:

  • Purple sticky note: What is going well / what has been your favorite part of the workshop so far?

  • Orange sticky note: What is still unclear or confusing?