# Working with air quality and meteorological data Exercises (Part-3)

**R-exercises**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Atmospheric air pollution is one of the most important environmental concerns in many countries around the world, and it is strongly affected by meteorological conditions. Accordingly, in this set of exercises we use `openair`

package to work and analyze air quality and meteorological data. This packages provides tools to directly import data from air quality measurement network across UK, as well as tools to analyse and producing reports.

In the previous exercises set we used data from MY1 station to see how to import data and extract basic statistical information from data. Then we practiced a few basic functions that are available in `openair`

package. In this exercise set we will practice more advance functions that are very useful for air quality data analysis.

Answers to the exercises are available here.

For other parts of this exercise set follow the tag openair

Please load the package `openair`

before starting the exercises.

**Exercise 1**

In the first exercise we will use `timeVariation`

function to see the variation of a pollutant by time of day and day of week which can reveal useful information. For example, o3 is

produced only during daytime so it is typically expected to be maximum in the afternoon and reaches its minimum during nighttime. The `timeVariation`

function produces four plots: day of the week variation, mean hour of day variation and a combined hour of day – day of week plot and a monthly

plot.

Use `timeVariation`

function to plot timeseries for pm10 and o3 for my1data that was used in the previous exercise sets.

**Exercise 2**

`timeVariation`

function is also flexible to subset data based on the given conditions. For example one can set the conditions to consider only those hours when wind speed and direction is in a specific range.

Use `timeVariation`

function to plot timeseries for pm10 and o3 for my1data. Only consider those hours when ws > 5 and wd is between 50 and 200.

**Exercise 3**

It is also possible to see the time series of multiple variables using `timeVariation`

. For example the production of o3 is strongly depends on its precursors including, nox, no2, and co. So it would be very useful to see the variation of o3 concentration with its precursors.

Use `timeVariation`

function to plot time series for o3, nox, no2, and co for my1data.

**Exercise 4**

Another interesting function that is available in `openair`

is `scatterPlot`

function. The purpose of this function is to make it straightforward to consider how variables are related to one another in a way consistent with other `openair`

functions.

use `scatterPlot`

to show scatter plot of daily o3 concentration for the month of April with different levels of ambient temperature.

**Exercise 5**

use `scatterPlot`

to show scatter plot of nox vs no2 concentration by the level of temperature in each season.

**leave a comment**for the author, please follow the link and comment on their blog:

**R-exercises**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.