daily_stats: Daily Statistics

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/ares.r

Description

Compute daily basis statistics from hourly measures

Usage

1
2
daily_stats(dataset, parameter, first.column = 2, date = TRUE,
	samples = 24, statistic = "mean", daylight=c(6,19), date.format = "%d/%m/%Y")

Arguments

dataset

input dataset

parameter

quoted string indicating the environmental parameter rules

first.column

index of the first column of actual data. The first column is usually allocated for dates, so default is 2

date

a logical indicating whether the resulting dataset should contain a date column

samples

an integer indicating the number of samples per day

statistic

a quoted string indicating the aggregation function. Default is "mean". See Details

daylight

a vector indicating the daylight hours. Default is c(,6,19)

date.format

a string indicating the date format for the horizontal axis. Default is dd/mm/yyyy. See strptime for options

Details

This is an environmental-specific function. Suppose, for instance, that during the day 24 measurements of a pollutant concentration are taken and one wants to compute daily statistics about the monitored parameter. Besides, when parameter is set to some “known” air pollutant, the aggregation is computed according to specific predefined rules.

The available statistics are: "mean", "min", and "max". Whilst min and max are the trivial maximum and minimum respectively, mean are computed using different rules for each pollutant.

The implemented rules for the mean of some pollutants are the following:

TEMP or HUMID: ordinary daily mean are computed;

PM10 or SO2: daily mean are computed if at least three quarters of hourly observations is not missing;

NO2 or O3: daily mean are computed if at least three quarters of hourly observations is not missing and at least one quarter lies between 6 a.m and 6 p.m.;

CO: if parameter is set to CO, statistic is ignored and the maximum 8-hour running mean is computed.

Attention! Be sure that all columns on the dataset share the same rule for statistic computation, otherwise it will produce wrong values.

Both parameter and statistic are not case sensitive.

Value

A data frame with the same columns there are in dataset plus the date column.

Author(s)

Washington Junger wjunger@ims.uerj.br and Antonio Ponce de Leon ponce@ims.uerj.br

References

Schwartz, J., Spix, C., Touloumi, G. et al. (1996) Methodological issues in studies of air pollution and daily counts of deaths or hospital admissions. J Epidemiol. Community Health 50 (suppl 1), S12–S18.

See Also

import_data,export_data

Examples

1
2
3
## Not run:
# pm.mean <- daily_stats(pm.filled,"PM10",statistic="mean")
## End (Not run)

wjunger/ares documentation built on Dec. 23, 2021, 5:17 p.m.