11.07.2015 Views

Package 'openair'

Package 'openair'

Package 'openair'

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

86 polarClustercolsDetailsangle.scaleunitsauto.textColours to be used for plotting. Useful options for categorical data are avilablefrom RColorBrewer colours — see the openair openColours function formore details. Useful schemes include “Accent”, “Dark2”, “Paired”, “Pastel1”,“Pastel2”, “Set1”, “Set2”, “Set3” — but see ?brewer.pal for the maximumuseful colours in each. For user defined the user can supply a list of colournames recognised by R (type colours() to see the full list). An example wouldbe cols = c("yellow", "green", "blue").The wind speed scale is by default shown at a 315 degree angle. Sometimesthe placement of the scale may interfere with an interesting feature. The usercan therefore set angle.scale to another value (between 0 and 360 degrees) tomitigate such problems. For example angle.scale = 45 will draw the scaleheading in a NE direction.The units shown on the polar axis scale.Either TRUE (default) or FALSE. If TRUE titles and axis labels will automaticallytry and format pollutant names and units properly e.g. by subscripting the ‘2’ inNO2.... Other graphical parameters passed onto polarPlot, lattice:levelplot andcutData. Common axis and title labelling options (such as xlab, ylab, main)are passed via quickText to handle routine formatting.Bivariate polar plots generated using the polarPlot function provide a very useful graphical techniquefor identifying and characterising different air pollution sources. While bivariate polar plotsprovide a useful graphical indication of potential sources, their location and wind-speed or othervariable dependence, they do have several limitations. Often, a ‘feature’ will be detected in a plotbut the subsequent analysis of data meeting particular wind speed/direction criteria will be basedonly on the judgement of the investigator concerning the wind speed-direction intervals of interest.Furthermore, the identification of a feature can depend on the choice of the colour scale used,making the process somewhat arbitrary.polarCluster applies Partition Around Medoids (PAM) clustering techniques to polarPlot surfacesto help identify potentially interesting features for further analysis. Details of PAM can befound in the cluster package (a core R package that will be pre-installed on all R systems). PAMclustering is similar to k-means but has several advantages e.g. is more robust to outliers. Theclustering is based on the equal contribution assumed from the u and v wind components and theassociated concentration. The data are standardized before clustering takes place.The function works best by first trying different numbers of clusters and plotting them. This isachieved by setting n.clusters to be of length more than 1. For example, if n.clusters = 2:10then a plot will be output showing the 9 cluster levels 2 to 10.Note that clustering is computationally intensive and the function can take a long time to run —particularly when the number of clusters is increased. For this reason it can be a good idea to run afew clusters first to get a feel for it e.g. n.clusters = 2:5.Once the number of clusters has been decided, the user can then run polarCluster to return theoriginal data frame together with a new column cluster, which gives the cluster number as acharacter (see example). Note that any rows where the value of pollutant is NA are ignored so thatthe returned data frame may have fewer rows than the original.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!