R Studio and its packages are used by hundreds of thousands of people to make millions of plots. I use it to compare air sensor data from different air quality monitors/sensors or to visualize air pollution levels.
In this article we will explore both how we can visualize air quality data from publicly available sources and how you can create statistical correlations between different pollutants or different sensors to find the correlation coefficient or correlation of determination.
First: Get the Right Packages
Packages are collections of functions, data, and compiled code in a well-defined format, created to add specific functionality. Here are some of the packages that we will install inside RStudio and use.
#You can either get ggplot2 by installing the whole tidyverse library
install.packages(tidyverse)
#Alternatively, install just ggplot2
install.packages(ggplot2)
#saqgetr is a package to import European air quality monitoring data in a fast and easy way
install.packages(saqgetr)
#worldmet provides an easy way to access data from the NOAA Integrated Surface Database
install.packages(worldmet)
#Date-time data can be frustrating to work with in R and lubridate can help us fix possible issues
install.packages(lubridate)
#Openair is a package developed for the purpose of analysing air quality data
linstall.packages(openair)
Read More » 