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.
Screenshots of RStudio
Screenshots of code
Code blocks with R Markdown (or Quarto!)
# 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
webR
What is webR?
webR is a version of R that runs in a web browser.