Hiding in Plain Text: Tools and Techniques for Teaching Effectively and Efficiently

Simon A. Queenborough School of Forestry & Environmental Studies

Center for Teaching and Learning, Yale University 2017-11-14

What do I teach?

FES720 Introduction to R

FES717 Tropical Field Ecology

How did an ecologist end up teaching stats and programming?

What is R?

old-school R

Very different from IT experience of most learners

Can be intimidating

RStudio (IDE for R) is a bit better, but not much

Solution: Treat learning R as learning a foreign language

Part 1: Teaching Effectively

Mimics the way we naturally learn.

  1. Motivation

  2. Try something

  3. Feedback (worked/didn’t work)

  4. Try again (same/different)

Effective learning is based on:

  1. Repetition

  2. Assessment

  3. Rapid feedback

Traditional lecture class

Lecture -> Textbook -> Homework -> Exam

A more interactive approach

Reading -> Mini Lecture -> Interactive Lesson -> Lab w Feedback

Interactive computer-based learning

Followed rapid, short-cycle approach.

But, no good interactive environment for R

SWIRL fixes these issue

SWIRL: Statistics With Interactive R Learning

Every new tech thing needs a nice acronym and logo

What SWIRL is

an R package for teaching and learning statistics and R simultaneously and interactively

What SWIRL is

Lessons are a dialogue between swirl and the user

Composed of:

Responses are evaluated for correctness based on instructor-specified answer tests.

Why are we using swirl?

Students work directly in R console = real working environment.

Allows immediate evaluation of code and immediate feedback.

Allows remote logging of scores so I can check progress and provide feedback.

1. Install SWIRL package

You only need to do this once.

# install swirl. 
# Requires ""
install.packages("swirl")

2. Install the lessons

Lessons for FES720 are on my GitHub page

(github = social coding site, sharing code)

You only need to do this once (for now, until we find errors, etc)

# load the swirl pakcage
library(swirl)

# access github and download the course
# (this function is provided with the swirl package)
install_course_github("saq", "fes720_Basic")

This command downloads the first set of lessons to your computer.

3. Start swirl

You will need to do this every time you start R or want to continue an old lesson or start a new lesson.

# load the swirl package into your current R session
# (No need for "")
library(swirl)

| Hi! Type swirl() when you are ready to begin.

# start swirl ... 
# (swirl is a function, so you need '()')
swirl()

4. Choose a name

> library(swirl)

| Welcome to swirl! Please sign in. 
| If you've been here before, use the same name as you did then. 
| If you are new, call yourself something unique.

What shall I call you? 

Enter your name.

I will need to be able to identify you, so please use:

This name will also allow you to continue lessons if you stop them in the middle.

5. Choose a course

| Please choose a course, or type 0 to exit swirl.

1: fes720 Basic
2: Take me to the swirl course repository!

Selection: 

We will be working through the lessons in the ‘fes720 Basic’ course.

Type: ‘1’

6. Choose a lesson

| Please choose a lesson, or type 0 to return to course menu.

1: Basic Building Blocks
2. ...
...

Choose the first lesson: Basic Building Blocks

Type: ‘1’

7. Do the lesson!

| Attempting to load lesson dependencies...

| Package base64enc loaded correctly!

  |                                                                            |   0%

| In this lesson, we will explore some basic building blocks of the R programming language.

...

Hit ‘Enter’ to advance when presented with ‘…’

The screen also shows you how far through the lesson you are (0%).

8. Completing the lesson

You will need to be connected to the internet to submit your lesson

When you are done, the last question will ask if you want to submit your answers to me to verify that your completed the lesson.

You should enter the number of your response (usually ‘1’).

This will bring up a new web page, a Google form.

Scroll down, and click ‘submit’.

This will send an excrypted response to the Google form so that I can verify you completed the lesson.

How does SWIRL fit in with wider course structure?

Learning Goals & Outcomes

Successful students will be able to:

  1. Foundational knowledge (information and ideas)

. . .

  1. Application (skills, thinking and project management)

. . .

Assessment

The course will be assessed via:

There are no final examinations.

Weekly Plan

Sat/Sun: Reading before class

Mondays: Background lecture on topic and lessons

Wednesdays: Best Practice lecture and labs

Fridays: R Bootcamp

How does this structure fit our model of learning?

  1. Motivation

  2. Repetition

  3. Assessment

  4. Rapid Feedback

1. Motivation

2. Repetition

3. Assessment

BUT

4. Rapid feedback

Another solution …

Start them young

Part II: Teaching Efficiently

Teaching efficiently (to me) means …

Teaching efficiently (to me) means …

Compounded by smartphone/tablet way of interacting with computers

A second IT revolution

Open-source tools for plain-text coding, data analysis, and writing are also better and more accessible than they have ever been.

Office vs Engineering model of working

Based on work by Kieren Healy

The Office Model

e.g., M.S. Word file

The Engineering Model

e.g., plain-text file

The Engineering Model

Principles

  1. Keep a Record

  2. Write and Edit

  3. Reproduce Work

  4. Pull it Together

1. Keep a Record

Know what you did

Use version control

e.g., git, subversion, ..

e.g., Github

Back up your work

e.g., Dropbox, YaleBox, …

2. Write and Edit

Use a Text Editor

e.g., too many! Notepad+, …

Use Markdown

# 2. Write and Edit

## Use Markdown

- Now, a standard _mark-up_ language

- Simple format for structural info + easy to read

Use R + IDE (e.g., RStudio/ESS)

3. Reproduce Work

Minimize error

Decrease gap between data and results section

How? Embed code within manuscript

Blah, blah, as you see in Fig. 1 blah ...

```r
# Embed chunks of code
my_data <- read.table('my_awesome_data.txt')
plot(my_data$x ~ my_data$y)
 
Now, turning to blah ... 

4. Pull it Together

Further Reading

plain text

http://wcm1.web.rice.edu/plain-text-citations.html

http://mnmlist.com/a-case-for-storing-all-your-info-in-text-files/

http://kieranhealy.org/blog/archives/2014/01/23/plain-text/

http://programminghistorian.org/lessons/sustainable-authorship-in-plain-text-using-pandoc-and-markdown

Markdown

http://inundata.org/2012/12/04/how-to-ditch-word/

http://inundata.org/2012/06/01/markdown-and-the-future-of-collaborative-manuscript-writing/

http://wcm1.web.rice.edu/plain-text-citations.html

http://mnmlist.com/a-case-for-storing-all-your-info-in-text-files/

http://kieranhealy.org/blog/archives/2014/01/23/plain-text/

http://programminghistorian.org/lessons/sustainable-authorship-in-plain-text-using-pandoc-and-markdown

http://lifehacker.com/5943320/what-is-markdown-and-why-is-it-better-for-my-to+do-lists-and-notes

http://chronicle.com/blogs/profhacker/markdown-the-syntax-you-probably-already-know/35295

http://www.practicallyefficient.com/2011/07/21/word-internet/

http://markdowntutorial.com/

https://daringfireball.net/projects/markdown/basics

Reproducible research

http://conjugateprior.org/2013/03/tools-for-making-a-paper/

http://hybridpedagogy.com/Journal/files/GitHub_for_Academics.html

https://github.com/SChamberlain/esamd

======

Resources

Tools

R A platform for statistical computing.

RStudio IDE for R.

knitr Reproducible documents with R.

LaTeX Detailed mark-up language and typesetting system.

pandoc Converts plain-text to many other formats.

git Version control system.

github Social web-based version of git.

Guides

Intro to R My course!

RMarkdown cheatsheet

RStudio cheatsheet