+ - 0:00:00
Notes for current slide
Notes for next slide

🔨 Tools for Integrating Data Science in the Introductory and Intermediate Statistics Classroom


🔗 http://bit.ly/tools4ds


🌈 Dr. Allison Theobold
🎲 Dr. Kelly Bodwin

February 19, 2021

you...

  • know R
  • are familiar with R Markdown
  • are interested in integrating R into your course(s)

Tools

  1. At-home Install
  2. RStudio Cloud
  3. Shiny Apps
  4. learnr Tutorials

At-home Installs

Cautionary Tale 1:

Old versions of Mac

  • Most of what you want to teach will work with older versions of R...

Cautionary Tale 1:

Old versions of Mac

  • Most of what you want to teach will work with older versions of R...

  • ... but earlier than R 3.4 is a problem.

Cautionary Tale 1:

Old versions of Mac

  • Most of what you want to teach will work with older versions of R...

  • ... but earlier than R 3.4 is a problem.

  • Solution: Have students on old machines use RS Cloud.

Cautionary Tale 2:

Installing on any Mac

Cautionary Tale 3:

All the package headaches

Cautionary Tale 3:

Continued...

Do you want to install from sources the package which needs compilation?

Cautionary Tale 3:

Continued...

Do you want to install from sources the package which needs compilation?

Do you want to install from developer version sources as opposed to CRAN version the package which needs compilation?

Cautionary Tale 3:

Continued...

Do you want to install from sources the package which needs compilation?

Do you want to install from developer version sources as opposed to CRAN version the package which needs compilation?

Cautionary Tale 3:

Continued...

Error in loadNamespace(name) : there is no package called 'here'

or

Error in library(here) : there is no package called 'here'

Cautionary Tale 3:

Continued...

Error in loadNamespace(name) : there is no package called 'here'

or

Error in library(here) : there is no package called 'here'
  • This means that a dependency didn't auto-install like it should have.

Cautionary Tale 3:

Continued...

Error in loadNamespace(name) : there is no package called 'here'

or

Error in library(here) : there is no package called 'here'
  • This means that a dependency didn't auto-install like it should have.

  • Why?

Cautionary Tale 3:

Continued...

Error in loadNamespace(name) : there is no package called 'here'

or

Error in library(here) : there is no package called 'here'
  • This means that a dependency didn't auto-install like it should have.

  • Why?

  • No idea. Just install the package directly

install.packages("here")

Cautionary Tale 3:

Continued...

Error: package or namespace load failed for 'tidyverse' in loadNamespace(j <-
i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): namespace 'tibble'
2.1.3 is already loaded, but >= 3.0.0 is required

Cautionary Tale 3:

Continued...

Error: package or namespace load failed for 'tidyverse' in loadNamespace(j <-
i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): namespace 'tibble'
2.1.3 is already loaded, but >= 3.0.0 is required

This means you're trying to update a package that's in use!

Cautionary Tale 3:

Continued...

Error: package or namespace load failed for 'tidyverse' in loadNamespace(j <-
i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): namespace 'tibble'
2.1.3 is already loaded, but >= 3.0.0 is required

This means you're trying to update a package that's in use!

Clear out the environment, including "hidden objects"

Close other R/RStudio windows.

Try to install again.

Cautionary Tale 4:

Gen Z doesn't understand folders

Things I have seen students do...

Cautionary Tale 4:

Gen Z doesn't understand folders

Things I have seen students do...

  • Download a dataset to a random folder, expect it to be read into R automatically.

Cautionary Tale 4:

Gen Z doesn't understand folders

Things I have seen students do...

  • Download a dataset to a random folder, expect it to be read into R automatically.

  • Never save or knit their R Markdown file. Lose everything when something crashes.

Cautionary Tale 4:

Gen Z doesn't understand folders

Things I have seen students do...

  • Download a dataset to a random folder, expect it to be read into R automatically.

  • Never save or knit their R Markdown file. Lose everything when something crashes.

  • Re-download the lab every time they want to work on it, open it from their downloads folder, copy paste code from a Google Doc.

Cautionary Tale 4:

Gen Z doesn't understand folders

Things I have seen students do...

  • Download a dataset to a random folder, expect it to be read into R automatically.

  • Never save or knit their R Markdown file. Lose everything when something crashes.

  • Re-download the lab every time they want to work on it, open it from their downloads folder, copy paste code from a Google Doc.

  • Re-download R or RStudio every time they want to open it.

Cautionary Tale 5:

Equality of assessment

  • Using a Studio computer means students taking exams out of their comfort zone...

Cautionary Tale 5:

Equality of assessment

  • Using a Studio computer means students taking exams out of their comfort zone...

  • ... but troubleshooting individual laptops during an exam is impossible!

Cautionary Tale 5:

Equality of assessment

  • Using a Studio computer means students taking exams out of their comfort zone...

  • ... but troubleshooting individual laptops during an exam is impossible!

  • Not all students can afford the most powerful computer.

Cautionary Tale 5:

Equality of assessment

  • Using a Studio computer means students taking exams out of their comfort zone...

  • ... but troubleshooting individual laptops during an exam is impossible!

  • Not all students can afford the most powerful computer.

  • Not all students have a laptop computer they can bring to class.

RStudio Cloud

Lots of Friction

  • Install R
  • Install RStudio
  • Install the following packages:
    • rmarkdown
    • tidyverse
    • ...
  • Load these packages
  • Install git
  • Install MiKteX

Lots of Friction

  • Install R
  • Install RStudio
  • Install the following packages:
    • rmarkdown
    • tidyverse
    • ...
  • Load these packages
  • Install git
  • Install MiKteX

Less Friction

  • Go to rstudio.cloud
  • Log in
>hello R!

* Çetinkaya-Rundel, Mine. "Teaching R online with RStudio Cloud." RStudio Webinar.

What is RStudio Cloud?

We created RStudio Cloud to make it easy for professionals, hobbyists, trainers, teachers, and students to do, share, teach, and learn data science using R.

Workspaces

Projects


A new project in RStudio Cloud


is a new project in RStudio IDE

PSA: If you use RStudio, use projects! Trust me, you won’t regret it.

Sharing Options


  • Option 1: Share a single project

Sharing Options


  • Option 1: Share a single project
  • Option 2: Invite users to a workspace (presumably with many projects)
Sharing a Single Project

Good!

  • Students land directly in a project upon login
  • Works well for workshops where all work will be completed in a single project
  • Also great for sharing code in general, e.g. collaboration, reprexes, etc.
Sharing a Single Project

Good!

  • Students land directly in a project upon login
  • Works well for workshops where all work will be completed in a single project
  • Also great for sharing code in general, e.g. collaboration, reprexes, etc.

Not so good...

  • Students need to remember to make a copy of the project (which means you need to remember to remind them!)
  • You can't keep track which students started their assignment
  • You can't easily peek into student projects
Sharing a Workspace

Good!

  • Base projects with desired packages installed
  • Assignments -- no more "make a copy of the project before starting work"
  • Peek into students’ projects
Sharing a Workspace

Good!

  • Base projects with desired packages installed
  • Assignments -- no more "make a copy of the project before starting work"
  • Peek into students’ projects

Not so good...

  • Students land in the workspace, may need to provide instructions for the next steps
  • Git config for each project can get tedious and doesn't reflect realistic practice

Q: How do I access RStudio Cloud?




Shiny Apps

demo:

Good!

  • Students get experience with code without typing code

  • Gives them an easy "copy-paste" resource

  • No need to install or interact with R/RStudio

Good!

  • Students get experience with code without typing code

  • Gives them an easy "copy-paste" resource

  • No need to install or interact with R/RStudio

Not so good...

  • Apps need to be hosted somewhere

  • Many students using app at once = high computing demand

  • Hard to create (for now)



Solutions:

shindig

shindig

  • R package to create your own exercises

shindig

penguins %>%
filter(bill_length_mm > 5) %>%
ggplot(aes(x = {quant_var}, fill = {cat_var})) +
geom_histogram()
textInput("quant_var",
"What quantitative variable?")
textInput("cat_var",
"What categorical variable?")
decorate_shiny("plot1") %>%
shindig("renderPlot")
plotOutput("plot1")

learnr Tutorials

📦 learnr

  • learnr is an R package that makes it easy to create interactive tutorials from R Markdown documents.

  • Tutorials can include:

    • Narrative, figures, illustrations, and equations
    • Code exercises (R code chunks that users can edit and execute directly)
    • Multiple choice questions
    • Videos (YouTube, Vimeo)
    • Interactive Shiny components
  • learnr is on CRAN

install.packages("learnr")
demo


Components of a learnr tutorial

YAML

Start with a YAML, just like in R Markdown:

---
title: "Starting with Data"
output:
learnr::tutorial:
progressive: true
allow_skip: true
runtime: shiny_prerendered
---
  1. Create a new RMarkdown file
  2. Select from Template
  3. Choose the Interactive Tutorial template from learnr
  4. Start editing!

Narrative

  • R Markdown style section and subsection headings with ##, ###, etc.
  • Text, figures, illustrations, and equations.
  • Videos: supported services include YouTube and Vimeo

Multiple choice questions

quiz(
question("What position is the letter A in the english alphabet?",
answer("8"),
answer("14"),
answer("1", correct = TRUE),
answer("23"),
incorrect = "See [here](https://en.wikipedia.org/wiki/English_alphabet) and try again.",
allow_retry = TRUE
),
question("Where are you right now? (select ALL that apply)",
answer("Planet Earth", correct = TRUE),
answer("Pluto"),
answer("At a computing device", correct = TRUE),
answer("In the Milky Way", correct = TRUE),
incorrect = paste0("Incorrect. You're on Earth, ",
"in the Milky Way, at a computer.")
)
)

Code exercises - rendered



Code exercises - code

Code exercises - solution

Q: How do I share with my students?

Questions to Ponder

What are my resources?

  • Does your university have server time for hosting learnr/shindig tutorials?

What are my resources?

  • Does your university have server time for hosting learnr/shindig tutorials?

  • If not, does your university have funding sources to host these things elsewhere? (e.g. shinyapps.io)

What are my resources?

  • Does your university have server time for hosting learnr/shindig tutorials?

  • If not, does your university have funding sources to host these things elsewhere? (e.g. shinyapps.io)

  • Can you acquire funding for RStudio Cloud? Can you charge students to use it?

What are my resources?

  • Does your university have server time for hosting learnr/shindig tutorials?

  • If not, does your university have funding sources to host these things elsewhere? (e.g. shinyapps.io)

  • Can you acquire funding for RStudio Cloud? Can you charge students to use it?

  • How much do you enjoy creating/teaching with R resources?

What are my learning objectives?

  • If learning R is one of them...

...students should probably have a native install!

What are my learning objectives?

  • If learning R is one of them...

...students should probably have a native install!

  • If understanding how statisticians use code is one of them ...

... consider shindig tutorials, learnr tutorials with pre-supplied code, or RS Cloud.

What are my learning objectives?

  • If learning R is one of them...

...students should probably have a native install!

  • If understanding how statisticians use code is one of them ...

... consider shindig tutorials, learnr tutorials with pre-supplied code, or RS Cloud.

  • If software is not a learning objective...

... consider using R as a back-end only, to make your own life easier.

Thank you!

Allison

atheobol@calpoly.edu

@mtstatistics

@atheobold

Kelly

kbodwin@calpoly.edu

@kellybodwin

@kbodwin

you...

  • know R
  • are familiar with R Markdown
  • are interested in integrating R into your course(s)
Paused

Help

Keyboard shortcuts

, , Pg Up, k Go to previous slide
, , Pg Dn, Space, j Go to next slide
Home Go to first slide
End Go to last slide
Number + Return Go to specific slide
b / m / f Toggle blackout / mirrored / fullscreen mode
c Clone slideshow
p Toggle presenter mode
t Restart the presentation timer
?, h Toggle this help
Esc Back to slideshow