Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
rsconnect
data/sql_export*
data/export*
data/enrolment*
data/enrolment*
.positai
10 changes: 10 additions & 0 deletions .rscignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata
API/data/
.data/archive/
Documentation_files/
Documentation.html
Documentation.qmd

5 changes: 4 additions & 1 deletion R/dashboard_panels.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ homepage_panel <- function() {
column(
12,
h1("Pupil attendance and absence in schools in England"),
textOutput("source_version_release")
div(
class = "govuk-body-s govuk-!-margin-bottom-4",
textOutput("source_version_release")
)
),

## Left panel -------------------------------------------------------
Expand Down
12 changes: 5 additions & 7 deletions R/gov_colours.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
# https://meyerweb.com/eric/tools/color-blend/#FFBF47:B10E1E:3:hex gov red to yellow

map_gov_colours <- c(
"#FFBF47",
"#EC933D",
"#D86733",
"#C53A28",
"#B10E1E"
"#fecc5c",
"#fd8d3c",
"#f03b20",
"#bd0026",
"#800026"
)

# Test the palette

check_pal <- function(
x = gov_cols
) {
Expand Down
80 changes: 62 additions & 18 deletions R/line_formatters.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,55 @@
# headline_bullet <- function(
# value,
# comparator_value,
# statistic_name,
# geographic_level,
# la_name_in,
# region_name_in,
# subject = "sessions") {
# if (geographic_level == "Local authority") {
# area_string <- paste("in", la_name_in)
# comparator_level <- "REG"
# comparator_name <- paste(
# "the",
# region_la_lookup |>
# filter(la_name == la_name_in) |>
# pull(region_name)
# ) |>
# stringr::str_replace("the London", "London")
# } else if (geographic_level == "Regional") {
# area_string <- paste("in the", region_name_in) |>
# stringr::str_replace("the London", "London")
# comparator_level <- "NAT"
# comparator_name <- "England"
# } else {
# area_string <- ""
# comparator_level <- NULL
# }
# paste(
# paste0(
# value |>
# as.numeric() |>
# dfeR::round_five_up(dp = 1), "%"
# ),
# "of",
# subject,
# "were recorded as",
# statistic_name,
# area_string,
# ifelse(
# !is.null(comparator_level),
# paste0(
# "(compared to ",
# comparator_value |>
# as.numeric() |>
# dfeR::round_five_up(dp = 1),
# "% of sessions in ", comparator_name, ")"
# ),
# ""
# )
# )
# }

headline_bullet <- function(
value,
comparator_value,
Expand All @@ -13,8 +65,8 @@ headline_bullet <- function(
comparator_name <- paste(
"the",
region_la_lookup |>
filter(la_name == la_name_in) |>
pull(region_name)
dplyr::filter(la_name == la_name_in) |>
dplyr::pull(region_name)
) |>
stringr::str_replace("the London", "London")
} else if (geographic_level == "Regional") {
Expand All @@ -26,30 +78,22 @@ headline_bullet <- function(
area_string <- ""
comparator_level <- NULL
}

paste(
paste0(
value |>
as.numeric() |>
dfeR::round_five_up(dp = 1),
"%"
),
render_percents(value),
"of",
subject,
"were recorded as",
statistic_name,
area_string,
ifelse(
!is.null(comparator_level),
if (!is.null(comparator_level)) {
paste0(
"(compared to ",
comparator_value |>
as.numeric() |>
dfeR::round_five_up(dp = 1),
"% of sessions in ",
comparator_name,
")"
),
render_percents(comparator_value),
" of sessions in ", comparator_name, ")"
)
} else {
""
)
}
)
}
24 changes: 16 additions & 8 deletions R/utils.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
# render_percents <- function(values) {
# dfeR::round_five_up(
# as.numeric(
# values
# ),
# dp = 2
# ) |>
# paste0(
# "%"
# ) |>
# stringr::str_replace("NA%", "x")
# }

render_percents <- function(values) {
dfeR::round_five_up(
as.numeric(
values
),
dp = 1
sprintf(
"%.2f%%",
dfeR::round_five_up(as.numeric(values), dp = 2)
) |>
paste0(
"%"
) |>
stringr::str_replace("NA%", "x")
}
495 changes: 0 additions & 495 deletions data/EES_aut_data.csv

This file was deleted.

134,560 changes: 85,145 additions & 49,415 deletions data/EES_daily_data.csv

Large diffs are not rendered by default.

495 changes: 0 additions & 495 deletions data/EES_spr_data.csv

This file was deleted.

495 changes: 0 additions & 495 deletions data/EES_sum_data.csv

This file was deleted.

9,885 changes: 0 additions & 9,885 deletions data/EES_weekly_data.csv

This file was deleted.

495 changes: 0 additions & 495 deletions data/EES_ytd_data.csv

This file was deleted.

Loading
Loading