Skip to contents

Fixes heaping errors in time series. The structure of this function was taken from the function `find_heap_and_deheap` created by Kevin Zhao (https://github.com/davidearn/KevinZhao/blob/main/Report/make_SF_RData.R). This needs to be better documented.

Usage

WaveletDeheaper(
  time_variable = "period_end_date",
  series_variable = "deaths",
  first_date = "1830-01-01",
  last_date = "1841-12-31",
  week_start = 45,
  week_end = 5
)

Arguments

time_variable

column name of time variable in `data`, default is "period_end_date"

series_variable

column name of series variable in `data`, default is "deaths"

first_date

string containing earliest date to look for heaping errors

last_date

string containing last date to look for heaping errors

week_start

numeric value of the first week number to start looking for heaping errors

week_end

numeric value of the last week number to look for heaping errors

Value

function to fix heaping errors

## Returned Function

- Arguments * `data` data frame containing time series data - Return - all fields in `data` with an additional field called "deheaped_" concatenated with `series_variable`. If no heaping errors are found, this additional field is identical to the field `series_variable