Repository navigation
Dependency Changes
-
{MASS}(only used for one statistic type inpolarPlot()) and{readr}(only used for the discontinued European data inimportEurope()andimportMeta(source = "europe")) have been moved to Suggests. -
{openair}now requires{legendry}version 0.3.0 or later for features which use it (e.g.,corPlot(dendrogram = TRUE)).
Breaking Changes
-
importUKAQ()and its wrappers (importAURN(),importAQE(),importSAQN(),importWAQN(),importNI()andimportLocal()) no longer have defaultsiteandyeararguments, which previously silently imported data for an arbitrary site and year.yearmust now always be provided, andsitemust be provided unlessdata_typeis"annual","monthly"or"daqi", in which case omitting it imports all sites. Similarly,importImperial(),importKCL()andimportEurope()now require bothsiteandyearto be provided. -
importUKAQ()and its wrappers (e.g.,importAURN()) are stricter about some inputs and outputs:-
pollutantnow matches pollutants exactly whendata_typeis"annual","monthly"or"daqi", consistent with otherdata_types. Previously, partial matching meant that, e.g.,pollutant = "no"also returned NO2 and NOx. Capture rates, derived statistics (e.g.,"o3.daily.max.8hour") and gravimetric PM measurements are still returned alongside their pollutant. -
An unrecognised
data_typenow raises an error rather than a warning and silently importing hourly data instead. -
The
sourcecolumn is now always a character vector; previously it was a factor whensourcewas guessed.
-
-
Wind direction data in tibbles (e.g.,
mydataor data fromimportUKAQ()) are now checked and cleaned consistently withdata.frameinputs. Previously,wdvalues outside 0-360 were not removed and, where relevant, calms were not removed andwdwas not rounded for tibble inputs. This may change outputs for some functions. -
kzFilter()andkzaFilter()now usek = 3for them = 8761window by default (previouslyk = 5), which will change the default outputs of both functions. See New Features for more onk. -
cutData()factor levels for"weekend","dst"and"daylight"now always use a consistent order (e.g.,"DST"before"Non-DST","daylight"before"nighttime"), which may change panel and legend ordering. -
key.columnsnow defaults toNULLin most functions, which will use{ggplot2}'s logic for the number of columns. This may change legend layouts.
New Features
-
Added
distPlot(), which examines the 'shape' of the distribution of numeric data using histograms, frequency polygons, density plots or empirical cumulative distribution functions. -
All plots gain the
themeargument to provide a convenient way to set non-data plot aesthetic features, such as gridlines and fonts. The following options are provided:-
"default": the default{openair}theme. -
"dark": a dark-background variant of the default theme for presentations and low-light viewing. -
"modern": a minimalist, dashboard-style theme with reduced clutter and horizontal grid emphasis. -
"soft": a low-contrast, publication-focused theme with warm tones and gently muted colours for reports and dense plots. -
"print": a greyscale-first theme optimised for black-and-white output, with stronger structural elements for improved readability when printed. -
Any
ggplot2::theme()object, which will be used to modify the"default"theme.
-
-
refOpts()refinements:-
Gains the
label,label_sizeandlabel_colo(u)rarguments. These options require the{legendry}package and add direct labels to the reference lines on the opposite side to the numeric axes. -
Gains the
methodargument, which defaults to"line"to use the current behaviour but can now also be"band"to draw shaded regions rather than single lines. SeerefOpts()for more details.
-
-
variationPlot()gains theref.yargument. -
scatterPlot(linear = TRUE)now returns the fitted linear model coefficients in a newfitcomponent (e.g.,output$fit), with one row per panel andgroup. This includes the intercept, slope, their standard errors, R2 and the number of observations used (#454). -
key.rowshas been added alongsidekey.columns(which now defaults toNULL; see Breaking Changes).calendarPlot(),corPlot(),percentileRose(),polarAnnulus(),polarFreq(),polarPlot(),trendLevel()andwindRose()gain both arguments, which apply when their legend shows binned values. -
timePlot()gains thestepargument, which creates a "stairstep" plot instead of a traditional line chart. This is likely most useful for low resolution or 'multi-day' (e.g., diffusion tube) data. -
date.breaksin functions liketimePlot()can now take a character string, in line with thedate_breaksargument of functions likeggplot2::scale_x_datetime(). It may also takeNULL, which will use{ggplot2}defaults. -
windRose()now uses a diverging blue-white-red palette by default when comparing two sets of met data withws2andwd2. -
The
"gaf.seq"palette inopenColours()has been updated to reflect the latest guidance from the UK Government Analysis Function. -
importMeta()can now filter by site code, site name, site type, pollutants measured, and the distance from a given coordinate. -
kzFilter()andkzaFilter()now accept a vector fork, allowing a different number of iterations to be set for eachmwindow size (a single value is still recycled across allm). -
cutData(type = "daylight")(and therefore any use oftype = "daylight"and/orgroup = "daylight") now warns iflatitudeand/orlongitudeare not also provided. -
Numeric inputs (e.g.,
pollutant,ws,wd,obsandmod) are now checked consistently across{openair}. Numbers stored as text or factors are converted with a warning, and anything that can't be converted to numbers, such as dates or site names, raises an informative error. Previously, most functions failed with an unhelpful error, produced an empty plot, or (forwindRose(),pollutionRose()andTaylorDiagram()) silently converted these values toNA. This applies to all plotting functions that take numeric variables, as well asaqStats(),binData(),bootMeanDF(),calcPercentile(),GaussianSmooth(),kzFilter(),kzaFilter(),modStats(),rollingMean(),rollingQuantile(),runRegression(),selectRunning()andWhittakerSmooth(). -
The number of
typevalues is now checked consistently across all plotting functions, with a single informative error if too many are provided. Previously,percentileRose(),polarFreq(),pollutionRose(),scatterPlot(),smoothTrend(),TaylorDiagram(),TheilSen(),timeProp(),trajLevel(),trajPlot()andwindRose()silently accepted three or moretypes and produced overplotted panels, as only the first two were used for faceting.trendLevel()now errors rather than warning and dropping anytypes beyond the first two, andvariationPlot()no longer incorrectly says only onetypeis allowed when more than two are given.
Bug Fixes
-
Plotting functions (e.g.,
timeVariation()) now work with 'grouped' tibbles created withdplyr::group_by()by automatically ungrouping input data. -
ref.xandref.yaccept plain lists (e.g.,list(h = 10)) as well asrefOpts(). Plain lists also now default to a solid line, and labels default to the line colour. -
ColorBrewer palettes in
openColours()(and therefore all plotting functions):-
Qualitative palettes (e.g.,
"Set1") now use their first colours when fewer than three are needed, consistent with{ggplot2}. Previously, the first and last colours of the full palette were used instead (e.g., red and grey rather than red and blue for"Set1"). -
lightnessandsaturationare now applied for any number of colours. Previously, they were ignored unless more colours were requested than the palette contains.
-
-
calendarPlot(annotate = "value")now works correctly whenbreaksis notNULL. -
corPlot(cluster = FALSE)no longer raises a missing data error, and thedataobject is now constructed correctly. -
cutData()fixes:-
Factor levels no longer depend on the row order of the data. Previously,
"monthyear","quarteryear","seasonyear"and"week"levels were ordered by their first appearance in the data rather than chronologically, anddrop = "outside"could silently returnNAfor many rows (e.g.,"monthyear") if the data weren't sorted by date. -
"seasonyear"levels are now always chronological (e.g., winter 2003, spring 2003, ..., winter 2004). Previously,drop = "outside"anddrop = "none"placed winter after autumn within each year. -
A numeric
typecolumn containing a single unique value now produces a single level, rather than several meaningless intervals. -
Numeric
typecolumns are now always given the correct interval labels. Previously, if a quantile interval contained no data (e.g., with sparse or highly discrete data), the labels of all following intervals were shifted onto the wrong values.
-
-
importMeta()fixes:-
Any network whose metadata cannot be imported (e.g., if its server is temporarily unavailable) is now skipped with a warning rather than causing
importMeta()to fail completely; it only errors if no metadata can be imported at all. This also means thatimportUKAQ()can still guess thesourceof sites when another network is unavailable. -
end_dateis no longer returned as a character column ifyearis not given, and thestart_yearandend_yearcolumns are no longer returned if it is.
-
-
importUKAQ()and its wrappers (e.g.,importAURN()) are more robust to user input:-
pollutantis now genuinely case-insensitive for alldata_types; previously, e.g.,pollutant = "NO2"silently returned no pollutant data for hourly data. -
sourceis now case-insensitive, accepts the same aliases asimportMeta(), and raises an informative error if an unknown network is provided rather than failing silently. -
data_typeis now case-insensitive. -
ratified = TRUEnow correctly flags data for sites which are part of multiple networks (e.g., both the AURN and SAQN) when they are imported from more than onesource. -
ratified = TRUEno longer errors when importing data from locally managed networks, which have no ratification information. A warning is now raised and theirqcvalues areNA.
-
-
kzFilter(components = TRUE)andkzaFilter(components = TRUE)now return components when a singlemis provided. Previously, they were silently omitted. -
percentileRose()fixes:-
The north (0/360°) segment no longer disappears in some renderers. Previously, each shaded area wrapped slightly more than a full circle, overlapping itself at north, which renderers using the "even-odd" fill rule drew as a gap.
-
Wind directions with no data in a given panel are now shown as gaps when
typeis used. Previously, only one panel received the empty directions and the others were shaded straight across them.
-
-
polarCluster()once again clusters using only the polar plot surface, restoring the results of previous versions. Previously, other columns of the prediction grid were also used for clustering. -
polarPlot(upper = )once again limits the radial axis toupper. Previously, the axis always extended to the maximum ofx. -
selectByDate()now interpretsstartandendin the time zone ofmydata$daterather than UTC. -
selectRunning()no longer silently returns incorrect results whenpollutantcontains numbers stored as text. Previously, these were compared alphabetically againstthreshold(e.g.,"99"was treated as greater than500). -
timeAverage()no longer reports duplicate dates whenstart.dateandend.dateare already inmydata. -
timePlot()fixes:-
groupno longer errors ifavg.time = "default"andgroupis a 'date' option (e.g.,"season"). -
windflow = TRUEno longer duplicates rows whenwsorwdis apollutantandtypeorgroupis also used.
-
-
timeVariation()andvariationPlot()fixes:-
type = "wd"now uses the compass facet layout, consistent with other{openair}plotting functions. Previously, a standard wrapped facet layout was used. -
A caption referencing an irrelevant confidence interval is no longer added when
ci = FALSE. -
timeVariation()overall titles, subtitles and captions are now centred by default, in line with all other{openair}plotting functions.
-
-
trajCluster()now returns its plot as well as its data and the function call. -
trajLevel(statistic = "pscf", smooth = TRUE)no longer raises an error. -
WhittakerSmooth()now handles data with leading or trailingNAvalues, or which are entirelyNA.