Closed ghost closed 3 years ago
Assuming that Australia data (WMD or HMD - SMTF) adopted ISO-8601, should the code (below) in cleaning_script align with it,
# Group covid deaths by week australia_weekly_covid_deaths <- global_covid_source_latest %>% filter(date >= as.Date("2020-01-01")) %>% mutate(week_date = date, week = week(week_date), year = year(week_date), covid_deaths = Australia) %>% dplyr::select(date,year,week,covid_deaths) %>% group_by(year,week) %>% summarise(covid_deaths = sum(covid_deaths, na.rm=T)) %>% drop_na()
and change to something like,
# Group covid deaths by week australia_weekly_covid_deaths <- global_covid_source_latest %>% filter(date >= as.Date("2020-01-01")) %>% mutate(week_date = date, week = isoweek(week_date), year = isoyear(week_date), covid_deaths = Australia) %>% dplyr::select(date,year,week,covid_deaths) %>% group_by(year,week) %>% summarise(covid_deaths = sum(covid_deaths, na.rm=T)) %>% drop_na()
or
australia_weekly_covid_deaths <- global_covid_source_latest %>% filter(date >= as.Date("2020-01-01")) %>% mutate(week = as.numeric(str_sub(aweek::date2week(date,week_start=1),7,8)), year = as.numeric(str_sub(aweek::date2week(date,week_start=1),1,4)), covid_deaths = Australia) %>% dplyr::select(date,year,week,covid_deaths) %>% group_by(year,week) %>% summarise(covid_deaths = sum(covid_deaths, na.rm=T)) %>% drop_na()
Now fixed, thanks for spotting and reporting the issue.
Assuming that Australia data (WMD or HMD - SMTF) adopted ISO-8601, should the code (below) in cleaning_script align with it,
and change to something like,
or