Skip to contents

Prep data for wavelet plot. Prep steps were taken from code provided by Steven Lee (https://github.com/davidearn/StevenLee) and Kevin Zhao (https://github.com/davidearn/KevinZhao).

Arguments

data

data frame containing time series data

trend_data

data frame containing time series trend data

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_series"

trend_variable

column name of series variable in data, default is "deaths_trend"

series_suffix

suffix to be appended to series data fields

trend_suffix

suffix to be appended to trend data fields

wavelet_variable

name of the field in data to be wavelet transformed

output_emd_trend

name of output field for the empirical mode decomposition applied to trend_variable

output_norm

name of output field for the series_variable normalized by output_emd_trend

output_sqrt_norm

name of output field for the square root of output_norm

output_log_norm

name of output field for the logarithm of (output_norm + eps)

output_emd_norm

name of output field for the empirical mode decomposition applied to output_norm

output_emd_sqrt

name of output field for the empirical mode decomposition applied to output_sqrt_norm

output_emd_log

name of output field for the empirical mode decomposition applied to output_log_norm

output_detrend_norm

name of output field for the computed field output_norm-output_emd_norm

output_detrend_sqrt

name of output field for the computed field output_sqrt_norm-output_emd_sqrt

output_detrend_log

name of output field for the computed field output_log_norm-output_emd_log

data_harmonizer

function that harmonizes time scales and series names so there is one data point per time unit

trend_data_harmonizer

function that harmonizes time scales and trend names so there is one data point per time unit

data_deheaper

function that fixes heaping errors on series data

trend_deheaper

function that fixes heaping errors on trend data

joiner

function that joins series and trend data sets

interpolator

function that linearly interpolates series and trend data

normalizer

function that computes normalized fields

transformer

function that computes wavelet transform

Value

list containing: * transforemd_data - wavelet transformed data * tile_data_to_plot - data set of the wavelet transformed data prepped for plotting with ggplot2::geom_tile * contour_data_to_plot - data set of the transformed wavelet data prepped for plotting with ggplot2::geom_contour