<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/working-with-air-quality-and-meteorological-data-exercises-part-3/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://www.r-exercises.com/2017/09/12/working-with-air-quality-and-meteorological-data-exercises-part-3/"> R-exercises</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p><a rel="nofollow" href="http://www.r-exercises.com/wp-content/uploads/2017/09/12/esempio.bmp" target="_blank"><img alt="" width="442" src="http://www.r-exercises.com/wp-content/uploads/2017/08/esempio.bmp" class="wp-image-7351" height="215"></a>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 <code>openair</code> 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. </p>
<p>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 <code>openair</code> package. In this exercise set we will practice more advance functions that are very useful for air quality data analysis. </p>
<p>Answers to the exercises are available <a rel="nofollow" href="http://r-exercises.com/2017/09/12/working-with-air-quality-and-meteorological-data-exercises-part-3-solutions/" target="_blank">here</a>.</p>
<p>For other parts of this exercise set follow the tag <a rel="nofollow" href="http://r-exercises.com/tag/openair" target="_blank">openair</a></p>
<p>Please load the package <code>openair</code> before starting the exercises.</p>
<p><strong>Exercise 1</strong><br>
In the first exercise we will use <code>timeVariation</code> 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<br>
produced only during daytime so it is typically expected to be maximum in the afternoon and reaches its minimum during nighttime. The <code>timeVariation</code> 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<br>
plot. </p>
<p>Use <code>timeVariation</code> function to plot timeseries for pm10 and o3 for my1data that was used in the previous exercise sets.</p>
<p><strong>Exercise 2</strong><br>
<code>timeVariation</code> 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.</p>
<p>Use <code>timeVariation</code> function to plot timeseries for pm10 and o3 for my1data. Only consider those hours when ws > 5 and wd is between 50 and 200.</p>
<p><strong>Exercise 3</strong><br>
It is also possible to see the time series of multiple variables using <code>timeVariation</code>. 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.</p>
<p>Use <code>timeVariation</code> function to plot time series for o3, nox, no2, and co for my1data. </p>
<div>
<aside><img src="http://www.r-exercises.com/2017/09/12/working-with-air-quality-and-meteorological-data-exercises-part-3/"></aside>
<div>You can use Air Quality Data and weather patterns in combination with spatial data visualization, <strong>Learn more</strong> about spatial data in the online course <a rel="nofollow" href="http://www.r-exercises.com/product/intermediate-spatial-data-analysis-with-r-qgis-more/" target="_blank"><br>
[Intermediate] Spatial Data Analysis with R, QGIS &amp; More</a>. this course you will learn how to:
<ul>
<li>Work with Spatial data and maps</li>
<li>Learn about different tools to develop spatial data next to R</li>
<li>And much more</li>
</ul>
</div>
</div>
<p><strong>Exercise 4</strong><br>
Another interesting function that is available in <code>openair</code> is <code>scatterPlot</code> 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 <code>openair</code> functions.</p>
<p>use <code>scatterPlot</code> to show scatter plot of daily o3 concentration for the month of April with different levels of ambient temperature.</p>
<p><strong>Exercise 5</strong><br>
use <code>scatterPlot</code> to show scatter plot of nox vs no2 concentration by the level of temperature in each season.</p>
<div>
<h3>Related exercise sets:</h3>
<ol>
<li><a rel="nofollow" href="http://www.r-exercises.com/2017/08/29/working-with-air-quality-and-meteorological-data-exercises-part-2/" title="Working with air quality and meteorological data Exercises (Part-2)" target="_blank">Working with air quality and meteorological data Exercises (Part-2) </a></li>
<li><a rel="nofollow" href="http://www.r-exercises.com/2017/08/15/working-with-air-quality-and-meteorological-data-exercises-part-1/" title="Working with air quality and meteorological data Exercises (Part-1)" target="_blank">Working with air quality and meteorological data Exercises (Part-1) </a></li>
<li><a rel="nofollow" href="http://www.r-exercises.com/2016/12/11/descriptive-analytics-part-5-data-visualisation-categorical-variables/" title="Descriptive Analytics-Part 5: Data Visualisation (Categorical variables)" target="_blank">Descriptive Analytics-Part 5: Data Visualisation (Categorical variables) </a></li>
<li><a rel="nofollow" href="http://www.r-exercises.com/start-here-to-learn-r/" target="_blank">Explore all our (>1000) R exercises</a></li>
<li><a rel="nofollow" href="http://www.r-exercises.com/r-courses/" target="_blank">Find an R course using our R Course Finder</a> directory</li>
</ol>
</div>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://www.r-exercises.com/2017/09/12/working-with-air-quality-and-meteorological-data-exercises-part-3/"> R-exercises</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/epBLW6BMKyI" height="1"></a></div>