Usage
linearRelation(mydata, x = "nox", y = "no2", period = "month", condition = FALSE, n = 20, rsq.thresh = 0, ylab = paste0("slope from ", y, " = m.", x, " + c"), auto.text = TRUE, cols = "grey30", date.breaks = 5, ...)
Arguments
mydata
A data frame minimally containing date
and
two pollutants.
x
First pollutant that when plotted would appear on the
x-axis of a relationship e.g. x = "nox"
.
y
Second pollutant that when plotted would appear on the
y-axis of a relationship e.g. y = "pm10"
.
period
A range of different time periods can be
analysed. The default is month
but can be year
and week
. For increased flexibility an integer can be
used e.g. for 3-month values period = "3 month"
. Other
cases include "hour"
will show the diurnal relationship
between x
and y
and weekday the day of
the week relationship between x
and
y
. day.hour will plot the relationship by
weekday and hour of the day.
condition
For period = "hour"
, period = "day"
and period = "day.hour"
, setting condition =
TRUE
will plot the relationships split by year. This is
useful for seeing how the relationships may be changing over
time.
n
The minimum number of points to be sent to the linear
model. Because there may only be a few points e.g. hours
where two pollutants are available over one week, n
can
be set to ensure that at least n
points are sent to the
linear model. If a period has hours < n
that period
will be ignored.
rsq.thresh
The minimum correlation coefficient (R2)
allowed. If the relationship between x
and y
is
not very good for a particular period, setting
rsq.thresh
can help to remove those periods where the
relationship is not strong. Any R2 values below
rsq.thresh
will not be plotted.
ylab
y-axis title, specified by the user.
auto.text
Either TRUE
(default) or FALSE
. If
TRUE
titles and axis labels will automatically try and
format pollutant names and units properly e.g. by
subscripting the 2 in NO2.
cols
Colour for the points and uncertainty intervals.
date.breaks
Number of major x-axis intervals to use. The
function will try and choose a sensible number of dates/times
as well as formatting the date/time appropriately to the range
being considered. This does not always work as desired
automatically. The user can therefore increase or decrease the
number of intervals by adjusting the value of
date.breaks
up or down.
...
Other graphical parameters. A useful one to remove the
strip with the date range on at the top of the plot is to set
strip = FALSE
.