calcPercentile {openair} | R Documentation |
Calculate percentile values from a time series
Description
Calculates multiple percentile values from a time series, with flexible time aggregation.
Usage
calcPercentile(
mydata,
pollutant = "o3",
avg.time = "month",
percentile = 50,
data.thresh = 0,
start = NA
)
Arguments
mydata |
A data frame of data with a |
pollutant |
Name of variable to process. Mandatory. |
avg.time |
Averaging period to use. See |
percentile |
A vector of percentile values. For example |
data.thresh |
Data threshold to apply when aggregating data. See
|
start |
Start date to use - see |
Details
This is a utility function to calculate percentiles and is used in, for
example, timePlot
. Given a data frame with a date
field and one
other numeric variable, percentiles are calculated.
Value
Returns a data frame with new columns for each percentile level. New columns are given names like percentile.95 e.g. when percentile = 95 is chosen. See examples below.
Author(s)
David Carslaw
See Also
Examples
# 95th percentile monthly o3 concentrations
percentiles <- calcPercentile(mydata, pollutant ="o3",
avg.time = "month", percentile = 95)
head(percentiles)
# 5, 50, 95th percentile monthly o3 concentrations
## Not run:
percentiles <- calcPercentile(mydata, pollutant ="o3",
avg.time = "month", percentile = c(5, 50, 95))
head(percentiles)
## End(Not run)