trendLevel(mydata,
pollutant = "nox", x = "month", y = "hour",
type = "year", xlab = x, ylab = y,
typelab = NULL,
limits = c(0, 100), cols = "default", main = "",
strip = NULL, auto.text = TRUE, key.header = "use.stat.name",
key.footer = pollutant, key.position = "right", key = NULL,
statistic = c("mean", "max"), stat.args = NULL,
stat.safe.mode = TRUE, output = c("data", "graph"),
...)
pollutant
in mydata
to be sampled to produce the
trendLevel plot.y
and type
options to bin the data before applying statistic
(see
below). Allowed options currently include "hour"
, "mo
x
above.x
above.auto.text = TRUE
). By default trendLevel
uses x and y names as xlab and ylab, respectively, but does atcols
is passed
to openColours
for evaluation.auto.text = TRUE
).typelab
and associated plot strip. The option is passed to
levelplot
in lattice
for evaluation. Default (NULL
) allows
trendLevel
full control of strip. If enabled, auto.text = TRUE
allows labels
(xlab
, ylab
, main
, etc.) to be passed to the plot via quickText
.
auto.text = FALSE
turns this option ofkey.header = "", key.footer = c("mean","nox")
adds
the addition text as a scale footer. These arguments are passed to
"top"
, "right"
,
"bottom"
and "left"
.drawOpenKey
. See
drawOpenKey
for further details.pollutant
measurements with. Two options are currently encoded: "mean"
(default) and "max"
.
(Note: Functions can also be sent directly via stat
statistic
if this is a function. The
extra args should be supplied as a list of named parameters. (see Details below.)statistic
that most users can ignore. This option returns NA
instead of running
statistic
on binned subsamples that are empty. Many common funoutput = "data"
, generates the trendLevel
plot and returns the summary data. This can be retained using, e.g., my.ans <-
trendLevel(mydata)
and used in further analysis. The alternative setting (levelplot
in lattice
for evaluation.trendLevel
return either a data frame of the summarised information plotted
during the trendLevel call or the plot itself, depending on output
settings
(see above). In both cases the plot itself is produced as part if this operation.trendLevel
allows the use of third party summarising functions via the
statistic
option. Any additional function arguments should be supplied as
a list of named parameters as stat.args
.
For example, the encoded option statistic = "mean"
is equivalent to statistic = mean, stat.args = list(na.rm = TRUE)
. Many R
functions and user`s own code could be applied in a similar fashion, subject to the
following restrictions: the first argument send to the function must be the dataseries to
be analysed; the name `x' cannot be used for any of the extra options supplied in
stat.args
; and the function should return the required answer as a numeric or NA. Note:
If the supplied function returns more than one answer, currently only the first of these
is retained and used by trendLevel
.
If the function terminates with an error when it is sent an empty
data series, the stat.safe.mode = TRUE
can be used as this only evaluates populated
data series. Note: The option returns an NA without warning for empty data series.#basic use
trendLevel(mydata, pollutant = "nox")
#applying 'own' statistic
my.mean <- function(x) mean(x, na.rm= TRUE)
trendLevel(mydata, pollutant = "nox", statistic = my.mean)
Run the code above in your browser using DataLab