Teaching
in Introductory Data Science

Dr. Elijah Meyer

Duke University

2023-08-08

Outline

  1. How

  2. Benefits

How: Application Exercises

When First Teaching

  • Stick to “what’s familiar”

  • Stick to “basics”

Visual vs Source Tab

(a)

(b)

Figure 1: Source (a) vs Visual (b)

Quarto Layout

Quarto as a Teaching Tool

Once students have the layout…Lean into what Quarto has to offer

  • Informative Syntax and Completion

  • Informative Error Messages

Informative Syntax and Completion

Informative Errors and Common Mistakes

Approachability of Quarto error messages alleviates some tension in an intro class

Missing Syntax

#| label: plot1
#| warning false


In the Background Jobs pane:

Scanner error: while scanning a simple key at line 2, column 1 could not find
  expected : at line 3, column 1

Indentation Error

title: "Demo Document"
  author: "Student 1"
format: html
editor: visual


In the Background Jobs pane:

ERROR: YAMLError: bad indentation of a mapping entry at line 3, column 3:
      author: "Student 1"
      ^

How do we set this up?

In-class activity

Use well scaffolded Quarto documents

  • provide the code early

  • provide documentation

  • fill in the blank code

  • provide code with errors

Suggestions: In-class activity

Minimal chunk options

  • label:
  • warning:
  • message:
  • echo:
  • figure options

Minimal YAML

  • title:
  • author:
  • format:
  • editor:

In-class activity

Render early and often!

Benefits

From the student’s perspective

  • Useful tool: Good habit to build for future coursework + career

  • Proof of work: A project they can take with them

Project with Quarto

How we do it

How we do it

Project: Professional Document

R Markdown:

knitr::opts_chunk$set(echo = FALSE)  


Quarto: Easier to get started and attempts to “smooth” the edges of R Markdown

title: "Project Title" 
execute:
  echo: false

From the instructor’s perspective

Efficiency

  • Reproducible lessons to adapt

  • Consistent formatting = easier grading

Going Beyond

Citations

In Summary

  • Start minimal and build up!

  • Continuously practice

  • Reproducibility becomes not optional

  • Know that the investment pays off

Questions

Motivating Example

Crisis

Lack of Trust in Science (Fanelli 2018)

References

Fanelli, Daniele. 2018. “Is Science Really Facing a Reproducibility Crisis, and Do We Need It To?” Proceedings of the National Academy of Sciences 115 (11): 2628–31. https://doi.org/10.1073/pnas.1708272114.