Skip to contents

Weeks covering the year end are split into two records. The first week is adjusted to end on day 365 (or 366 in leap years), and the second week starts on the first day of the year. This was adapted from `LBoM::edge_fix` which keeps the same series variable value for both of the newly created weeks. This doesn't seem to make much difference when viewing the heatmap, however it might make sense to do something sensible like dividing the series variable value in half and allocating each week to have half of the values.

Weeks covering the year end are split into two records. The first week is adjusted to end on day 365 (or 366 in leap years), and the second week starts on the first day of the year. This was adapted from `LBoM::edge_fix` which keeps the same series variable value for both of the newly created weeks. This doesn't seem to make much difference when viewing the seasonal heatmap, however it might make sense to do something sensible like dividing the series variable value in half and allocating each week to have half of the values.

Usage

year_end_fix(
  data,
  series_variable = "deaths",
  start_year_variable = "Year",
  end_year_variable = "End Year",
  start_day_variable = "Day of Year",
  end_day_variable = "End Day of Year",
  temp_year_variable = "yr"
)

year_end_fix(
  data,
  series_variable = "deaths",
  start_year_variable = "Year",
  end_year_variable = "End Year",
  start_day_variable = "Day of Year",
  end_day_variable = "End Day of Year",
  temp_year_variable = "yr"
)

Arguments

data

data frame containing time series data

series_variable

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

start_year_variable

column name of time variable containing the year of the starting period, defaults to "Year"

end_year_variable

column name of time variable containing the year of the ending period, defaults to "End Year"

start_day_variable

column name of time variable containing the day of the starting period, defaults to "Day of Year"

end_day_variable

column name of time variable containing the day of the ending period, defaults to "End Day of Year"

temp_year_variable

temporary variable name when pivoting the data frame

Value

all fields in `data` with only records corresponding to year end weeks that have been split

all fields in `data` with only records corresponding to year end weeks that have been split