From 83ae0e23b2a62441bf397690fe172f85ee1758dd Mon Sep 17 00:00:00 2001 From: KATIE TEHRANI Date: Thu, 16 Jan 2025 11:35:10 +0000 Subject: [PATCH] adding in variance data downloads --- R/dashboard_panels.R | 15 ++++++++++++++- server.R | 16 +++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/R/dashboard_panels.R b/R/dashboard_panels.R index 2a8d33c..d581889 100644 --- a/R/dashboard_panels.R +++ b/R/dashboard_panels.R @@ -63,12 +63,25 @@ homepage_panel <- function() { ) ), br(), - p("The underlying national model data used by this app to calculate each student's value added result can also be downloaded as a .csv file"), + p("The underlying data used by this app to calculate each student's value added result and the confidence intervals can be downloaded here as .csv files. + These files include the national model data, the subject variance data, and the subject variance data for the disadvantaged cohort."), downloadButton( outputId = "model_data_download", label = "Model data (csv, 500KB)", icon = NULL, class = "gov-uk-button-secondary" + ), + downloadButton( + outputId = "subject_variance_download", + label = "Subject variance (csv, 50KB)", + icon = NULL, + class = "gov-uk-button-secondary" + ), + downloadButton( + outputId = "disadvantaged_subject_variance_download", + label = "Disadvantaged subject variance (csv, 50KB)", + icon = NULL, + class = "gov-uk-button-secondary" ) ) ) diff --git a/server.R b/server.R index 4f1e5f0..307424f 100644 --- a/server.R +++ b/server.R @@ -199,7 +199,7 @@ server <- function(input, output, session) { # }) # ----------------------------------------------------------------------------------------------------------------------------- - # ---- USER TEMPLATES - OUTPUT IN THE DATA UPLOAD TAB ---- + # ---- UNDERLYING DATA DOWNLOADS - OUTPUT IN THE DATA UPLOAD TAB ---- # ----------------------------------------------------------------------------------------------------------------------------- output$model_data_download <- downloadHandler( @@ -209,6 +209,20 @@ server <- function(input, output, session) { } ) + output$subject_variance_download <- downloadHandler( + filename = "subject_variance_data.csv", + content = function(file) { + write.csv(data$subject_variance, file, row.names = FALSE) + } + ) + + output$disadvantaged_subject_variance_download <- downloadHandler( + filename = "disadvantaged_subject_variance_data.csv", + content = function(file) { + write.csv(data$disadvantaged_subject_variance, file, row.names = FALSE) + } + ) + # ----------------------------------------------------------------------------------------------------------------------------- # ---- USER TEMPLATES - OUTPUT IN THE DATA UPLOAD TAB ---- # -----------------------------------------------------------------------------------------------------------------------------