fillup_hours: Fill up Hours

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

View source: R/ares.r

Description

Fill up missing hours in the hourly measured datasets

Usage

1
2
3
fillup_hours(input, date.time, readings = 24, cycle = seq(0, 23, by = 24/readings),
	start.date = NULL, end.date = NULL, date.format = "%d/%m/%Y", hour.format =
	"%H:%M:%S", offset = 0, sep = " ")

Arguments

input

a data frame. See Details

date.time

a quoted string with the name of a date and time formatted variable

readings

number of measures taken a day. Default is 24 (hourly)

cycle

a vector with the hours measures are taken. Default is a sequence from 0 to 24/measures

start.date

initial date for the dummy dataset

end.date

final date for the dummy dataset

date.format

date format. See strptime for options

hour.format

hour format. See strptime for options

offset

an integer with the number of minutes to shift minutes to "00". Default is 0

sep

character to separate date and time formats. Default is a space character

Details

This is an environmental-specific function. Suppose, for instance, that during the day, 24 measurements of a pollutant concentration are taken and if it is missing, the monitor keep the entry out of the log. Thus, at the end of the day less than 24 hourly entries are recorded. However, one needs a regular 24-hour vector to carry on with daily statistics computations, i.e., means, quantiles, etc.

This function reads the input dataset from a data frame. A complete dummy dataset with NA entries is built from the input parameters. Finally, the original dataset and the dummy dataset are merged using the date.time variables as reference. The resulting filled up dataset may be output to a data frame or directly to a file which format is supported by export_data.

Value

This function returns a data frame with missing filled up with NA.

Author(s)

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

See Also

import_data,export_data

Examples

1
2
3
## Not run:
# pm.filled <- fillup_hours(pm_hourly,"Date.Time")
## End (Not run)

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