Skip to content

jack-davison/rstudio_table-contest_2021

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RStudio Table Contest 2021: Honourable Mention Recipient

"Using gt, gtExtras and openair to present air quality monitoring data"

📝 The Table

Click to view

The table is best viewed [here] to "zoom in" on the openair plots!

👨‍🏫 The Tutorial

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:

  1. I wanted to present gt (the unfamiliar) in analogue to ggplot2 (the familiar).
  2. I wanted to "stage" the tutorial such that learners could drop off mid-way if desired.
  3. 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.

🗃️ The Repository

This repository is somewhat spartan, but the following files may be of interest:

  1. 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.
  2. rmd/table-contest-rmd.Rmd - This is the raw .Rmd file that knits to create the tutorial.
  3. qmd/table-contest-qmd.qmd - This is the raw .qmd file of the 2022 update of the tutorial, which uses Quarto.
  4. man/final-table.png - This is a static image of the final HTML table.

👋 About the Author

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.

   🐤 Twitter    •    💼 LinkedIn    •    ✍🏼 Blog    •    ORCID iD icon ORCID   

About

Tutorial for combining `gt` and `openair` to create air quality monitoring summary tables.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published