Functions to plot bivariate polar plots for air pollution data analysis. polarplotr uses openair functions but they have been enhanced to consider pair-wise statistics to compare two pollutants through correlation and regression.
The package documentation is in development and can be found http://davidcarslaw.github.io/polarplotr/.
For the main openair website, see http://davidcarslaw.github.io/openair/.
polarplotr has not been released on CRAN yet, therefore the development version must be installed. The best way to do this is to install the devtools package and use the install_github
function:
# If needed, install devtools
install.packages("devtools")
# Install development version of polarplotr
devtools::install_github("davidcarslaw/polarplotr")
At some point in the near future the existing polarPlot
function in openair will be removed and the polarplotr
version, which has more capabilities used instead. In the meantime it is best to load polarplotr after openair i.e.
library(openair)
library(polarplotr)
polarplotr main function is polarPlot
and the usage is the same as for openair's version. To use the enhancements of pair-wise statistics, a pair of pollutants is needed and the statistic argument differs. The function's help contains details on these options.
# Import air quality data for London Marylebone Road
data_mary <- importAURN(site = "my1", year = 2013, verbose = FALSE)
# Plot a "standard" polar plot
polarPlot(data_mary, pollutant = "no2", statistic = "mean")
# Plot correlation of particlate species
polarPlot(data_mary, pollutant = c("pm2.5", "pm10"), statistic = "r")
# How about the slope, with a newer colour map, will take a minute or two...
polarPlot(data_mary, pollutant = c("pm2.5", "pm10"), statistic = "robust_slope",
cols = "inferno")
# use quantile regression and median slope (tau = 0.5)
polarPlot(data_mary, pollutant = c("pm2.5", "pm10"), statistic = "quantile_slope",
tau = 0.5, cols = "inferno")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.