preproc_fill_daily {HyMETT}R Documentation

Fills daily data with missing dates as NA values

Description

Fills daily data with missing dates as NA values. Days that are absent from the daily time series are inserted with a corresponding value of NA.

Usage

preproc_fill_daily(
  data = NULL,
  Date,
  value,
  POR_start = NA,
  POR_end = NA,
  date_format = "%Y-%m-%d"
)

Arguments

data

'data.frame'. Optional data.frame input, with columns containing Date and value. Column names are specified as strings in the corresponding parameter. Default is NULL.

Date

'Date' or 'character' vector when data = NULL, or 'character' string identifying Date column name when data is specified. Date associated with each value in value parameter.

value

'numeric' vector when data = NULL, or 'character' string identifying values column name when data is specified.

POR_start

'character' value. Optional period of record start. If not specified, defaults to min(Date).

POR_end

'character' value. Optional period of record end. If not specified, defaults to max(Date).

date_format

'character' string. Format of Date. Default is "%Y-%m-%d".

Details

Can be used prior to preproc_precondition_data to fill daily data before computation of n-day moving averages, or prior to preproc_audit_data.

Value

A data.frame with Date and value, sequenced from POR_start to POR_end by 1 day.

See Also

preproc_audit_data, preproc_precondition_data

Examples

Dates = c(seq.Date(as.Date("2020-01-01"), as.Date("2020-01-10"), by = "1 day"),
          seq.Date(as.Date("2020-01-20"), as.Date("2020-01-31"), by = "1 day"))
values = c(seq.int(1, 22, 1))
preproc_fill_daily(Date = Dates, value = values)


[Package HyMETT version 1.1.2 Index]