RStudio Table Contest 2021: Honourable Mention Recipient
Click to view
The table is best viewed [here] to "zoom in" on the openair
plots!
The tutorial, presented using rmarkdown
, is an introduction to the gt
package for an air quality professional already fairly comfortable with R
, the tidyverse
and openair
. My approach when writing the tutorial was threefold:
- I wanted to present
gt
(the unfamiliar) in analogue toggplot2
(the familiar). - I wanted to "stage" the tutorial such that learners could drop off mid-way if desired.
- I wanted to present the most relevant and useful elements of
gt
for presenting air quality data specifically in an attractive and engaging way.
On point 2, I chose to present this very apparently, splitting the tutorial into three sections which build on one another. Each section uses rmarkdown
tabs to split the section up into, a), a mini-tutorial which guides the reader through the content, b), a code block which reproduces the entire table from scratch and, c), the table that is being created in that section. This ensures that more confident readers can quickly assess which level they would like to read to.
One of the key challenges of writing this was combining openair
- a commonly used, industry-standard visualisation package self-described as a product of its time - with gt
- a more modern tabulation tool. The key source of friction was inserting lattice
-based openair
plots into a gt
HTML table, as gt
only really streamlines the insertion of ggplot2
figures. This is sensible - ggplot2
has become the default tool for plotting in R - but in these fringe cases it can be useful to know how to marry the old and new.
This repository is somewhat spartan, but the following files may be of interest:
- R/create-full-table.R - This is a .R file that just contains the code to crate the HTML table. No external data is required for this.
- rmd/table-contest-rmd.Rmd - This is the raw .Rmd file that knits to create the tutorial.
- qmd/table-contest-qmd.qmd - This is the raw .qmd file of the 2022 update of the tutorial, which uses Quarto.
- man/final-table.png - This is a static image of the final HTML table.
I am an R Developer and Data Analyst, having recently completed a PhD in atmospheric chemistry at the Wolfson Atmospheric Chemistry Laboratories at the University of York in the United Kingdom, investigating how emissions from road transport impact the air we breathe. I accomplish much of my work through using R in the RStudio IDE, with a focus on the {tidyverse}
suite of R packages and the dedicated air quality analysis package {openair}
. I'm also keen on teaching reproducible data analysis through R, having become an Rstudio Certified Tidyverse Instructor in 2021.