Academic background in statistics, with experience in data science consultancy.
Teaching students with mathematical and non-mathematical backgrounds, at a variety of levels, in both academia and industry.
Teaching statistics with R
Many introductory (and more advanced) statistics courses also include instruction on using R.
Many courses teach statistical concepts in lectures, then the practical aspects of using R in separate workshops with smaller groups.
Including programming examples in a lecture environment isn’t always easy (for instructors and students).
Screenshots of RStudio
Screenshots of code
Including code blocks
# read in datacensus <- readxl::read_xlsx("Data/Census2021-health-la.xlsx", skip =4)# get local authority map shapefilesla_map <- sf::st_read("Data/Local_Authority_Districts_December_2021/LAD_DEC_2021_GB_BGC.shp") # calculate percentage that have bad/very badbad_health <- census |>mutate(Percentage =`Bad health \r\n(age-standardised \r\nproportions)`+`Very bad health \r\n(age-standardised \r\nproportions)`) |>select(`Area code`, Percentage) # highest / lowest percentageslice_max(bad_health, Percentage, n =1)slice_min(bad_health, Percentage, n =1)round(mean(bad_health$Percentage), 1)
Live coding!
Pros
shows the process of writing code
teaches students how to debug code
demonstrates good programming practices
Cons
Switching between windows
More pressure as a demonstrator
Hard for students to run the code themselves
Live coding!
How do we make live coding easier (and better)?
with webR!
What is webR?
webR is a version of R that runs in a web browser.
You don’t need to install R, or create a cloud account.
You don’t need to set up a server.
It just works (even on your phone).
Using webR for teaching
Interactive code blocks in slides
Interactive R console from slides
Deploying Shiny apps
Quarto Live
But first, Quarto…
Quarto is a way to combine code with text to create a variety of output formats. Essentially, second generation R Markdown that also natively supports other programming languages.
Create HTML slides:
---title: "Lecture 1"format: revealjs---
Adding code blocks with Quarto
```{r}# set a random seed and generate dataset.seed(123)x <- rnorm(100)# calculate standard deviationsd(x)```
# set a random seed and generate dataset.seed(123)x <-rnorm(100)# calculate standard deviationsd(x)