diff --git a/R/prerun_utils.R b/R/prerun_utils.R index 78a0c72..2d5d04d 100644 --- a/R/prerun_utils.R +++ b/R/prerun_utils.R @@ -304,9 +304,10 @@ process_attendance_data <- function(attendance_data_raw, start_date, end_date, p # Calculate total as (Primary rate X primary census count) + (Secondary rate X secondary census count) + (Special rate X special census count) and divided all by total census count attendance_data_daily_totals <- attendance_data %>% filter(breakdown == "Daily") %>% - group_by(breakdown, time_period, time_identifier, geographic_level, country_code, country_name, region_code, region_name, new_la_code, la_name, old_la_code, attendance_date, day_number) %>% + group_by(breakdown, time_period, time_identifier, geographic_level, country_code, country_name, region_code, region_name, new_la_code, la_name, old_la_code, attendance_date, day_number, week_commencing) %>% summarise(across(where(is.numeric), sum), .groups = "keep") %>% mutate( + school_type = "Total", attendance_perc = (sum(overall_attendance, na.rm = TRUE) / sum(possible_sessions, na.rm = TRUE)) * 100, overall_absence_perc = (sum(overall_absence, na.rm = TRUE) / sum(possible_sessions, na.rm = TRUE)) * 100, authorised_absence_perc = (sum(authorised_absence, na.rm = TRUE) / sum(possible_sessions, na.rm = TRUE)) * 100,