Skip to content

Commit

Permalink
Merge pull request #12 from dfe-analytical-services/dev-ks5-timeserie…
Browse files Browse the repository at this point in the history
…s-attainment-and-single-year-entries

updated renv, global and server
  • Loading branch information
patithomas authored Jan 31, 2024
2 parents 9103571 + 5fcf03a commit a06511b
Show file tree
Hide file tree
Showing 5 changed files with 1,170 additions and 655 deletions.
143 changes: 64 additions & 79 deletions R/dashboard_panels.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ homepage_panel <- function() {
title = "",
br(),
p("This dashboard allows users to explore time series data for 16 to 18 qualifications in England.
It brings together figures compiled from the current and previous versions of the A level and other 16 to 18 results statistical release with focus on:")
It brings together figures compiled from the current and previous versions of the <U+2018>A level and other 16 to 18 results<U+2019> statistical release with focus on:")
),
tags$div(
title = "Headline attainment and A level time series by institution type",
Expand All @@ -42,13 +42,12 @@ homepage_panel <- function() {
tags$div(
title = "(A level students entering maths and science by gender",
h3(actionLink("link_to_alevelMathsScience_tab", "A level students entering maths and science by gender")),
p("The line chart shows the yearly trend in the proportion of A level students entering maths and science from 2009/10 to 2022/23 (end of 16-18 study).
p("The line chart shows the yearly trend in the proportion of A level students entering maths and science from 2009/10 to 2022/23 (end of 16-18 study).
Select one subject or combination from the dropdown menu at the top of the page, followed by the start year to view changes over time (end year is fixed at the latest year available).")
),
),
tags$div(
title = "(A level subject entry and grade: comparison by subject",
h3(actionLink("link_to_alevelAllSubject_tab", "A level subject entry and grade: Comparison by subject")),

p("The line charts for subject entries and cumulative percentage grades display the yearly trend from 1995/96 to 2022/23.
Drop-down menus at the top of the page allows for the selection and comparison of up to four subjects
and cumulative grades.
Expand All @@ -57,7 +56,6 @@ homepage_panel <- function() {
),
tags$div(
title = "A level subject entry and result: comparison by gender",

h3(actionLink("link_to_alevelFmSubject_tab", "A level subject entry and result: Comparison by gender")),
p("The line charts for subject entries and cumulative percentage grades display the yearly trend for female and male from 1995/96 to 2022/23.
Expand Down Expand Up @@ -121,12 +119,12 @@ homepage_panel <- function() {
subjects grouped from 1995/96 to 2022/23. More detailed breakdowns of some subjects from 2015/16
are available via the full dataset download button at the top of the page."),
h4("Subject definitions"),
p("Total English covers English literature, English language, English language and literature. "),
p("Total Maths covers Maths, Pure maths, Statistics, Use of maths and Other maths"),
p("Total Modern languages cover French, German, Spanish and other foreign modern languages. "),
p("Total Classical studies covers Latin, Greek, Classical civilisation, and Other classical studies"),
p("STEM subjects cover Biology, Chemistry, Physics, Total maths, Further mathematics and Computer science. "),
p("Total Music includes Music and Music technology."),
p("Total English covers English literature, English language, English language and literature. "),
p("Total Maths covers Maths, Pure maths, Statistics, Use of maths and Other maths"),
p("Total Modern languages cover French, German, Spanish and other foreign modern languages. "),
p("Total Classical studies covers Latin, Greek, Classical civilisation, and Other classical studies"),
p("STEM subjects cover Biology, Chemistry, Physics, Total maths, Further mathematics and Computer science. "),
p("Total Music includes Music and Music technology."),
p("The data refers to all entries by 16-18 year olds in the year stated (where 2023 means 2022/23 academic year).")
)
)
Expand Down Expand Up @@ -378,7 +376,6 @@ dashboard_panel_aps <- function() {
dashboard_panel_sub_all <- function() {
tabPanel(
value = "dashboard_alse",

"A level subject entry & grade: comparison by subject (single academic year)",


Expand Down Expand Up @@ -578,7 +575,6 @@ dashboard_panel_sub_all <- function() {
dashboard_panel_sub_fm <- function() {
tabPanel(
value = "dashboard_fm",

"A level entry & result: comparison by gender (single academic year)",


Expand Down Expand Up @@ -764,9 +760,9 @@ dashboard_panel_ms <- function() {
tabPanel(
value = "dashboard_ms",
"A level maths & science: comparison by gender (end of 16-18 study)",

# Define UI for application that draws a histogram

# Sidebar with a slider input for number of bins
gov_main_layout(
gov_row(
Expand All @@ -782,17 +778,17 @@ dashboard_panel_ms <- function() {
gov_row(
column(
width = 6,

selectizeInput("subjectMs", "Select one subject or combination",
choices = list(
`Single subject` = list(
"Biology", "Chemistry", "Computer science", "Further maths", "Maths",
"Physics"
),

`Combination` = list("One maths/science subject", "Two maths/science subjects",
"Three maths/science subjects", "Four maths/science subjects", "Zero maths/science subjects")), selected = c("Maths")

choices = list(
`Single subject` = list(
"Biology", "Chemistry", "Computer science", "Further maths", "Maths",
"Physics"
),
`Combination` = list(
"One maths/science subject", "Two maths/science subjects",
"Three maths/science subjects", "Four maths/science subjects", "Zero maths/science subjects"
)
), selected = c("Maths")
)
),
column(
Expand Down Expand Up @@ -840,67 +836,56 @@ dashboard_panel_ms <- function() {
p(strong("Reset chart selection")),
align = "right",
actionButton(inputId = "resetSubMs", label = "Reset selections", icon = icon("fas fa-arrows-rotate"))
)

)
)
)
)


),
column(
width = 12,
tabsetPanel(
id = "tabsetpanel3",
tabPanel(
value = "alevelMsSubject",
"Maths and Science",
fluidRow(
column(
width = 12,
h3("A level maths and science: Comparison by gender"),
textOutput("textSubMs"), br()
# column(
# width = 6,
# paste("Download chart data:"), br(),
# downloadButton(
# outputId = "downloadSubMs",
# label = "Download data",
# icon = shiny::icon("download"),
# class = "downloadButton"
# )
# )
),
# valueBoxOutput("", width = 3),
# valueBoxOutput("boxapsGrade", width = 6),
box(
width = 12,
plotlyOutput("plotSubjectMs") %>% spinner()


)
),

),
column(
width = 12,
tabsetPanel(
id = "tabsetpanel3",
tabPanel(
value = "alevelMsSubject",
"Maths and Science",
fluidRow(
column(
width = 12,
# div(
# class = "well",
# style = "min-height: 100%; height: 100%; overflow-y: visible",
fluidRow(
column(width = 12),
p("Note: The number of students from 2009/10 to 2017/18 has been calculated from rounded data, so less precise than the number of students from
2018/19 to 2022/23")

)
h3("A level maths and science: Comparison by gender"),
textOutput("textSubMs"), br()
# column(
# width = 6,
# paste("Download chart data:"), br(),
# downloadButton(
# outputId = "downloadSubMs",
# label = "Download data",
# icon = shiny::icon("download"),
# class = "downloadButton"
# )
# )
),

dataTableOutput("tabMs"),


)
# valueBoxOutput("", width = 3),
# valueBoxOutput("boxapsGrade", width = 6),
box(
width = 12,
plotlyOutput("plotSubjectMs") %>% spinner()
)
),
column(
width = 12,
# div(
# class = "well",
# style = "min-height: 100%; height: 100%; overflow-y: visible",
fluidRow(
column(width = 12),
p("Note: The number of students from 2009/10 to 2017/18 has been calculated from rounded data, so less precise than the number of students from
2018/19 to 2022/23")
)
),
dataTableOutput("tabMs"),
)
)
)
)
)
)
}

46 changes: 22 additions & 24 deletions global.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ shhh <- suppressPackageStartupMessages # It's a library, so shhh!
shhh(library(shiny))
# shhh(library(shinya11y))
shhh(library(shinyjs))
#shhh(library(tools))
# shhh(library(tools))
shhh(library(testthat))
shhh(library(shinytest))
shhh(library(shinydashboard))
Expand All @@ -29,11 +29,10 @@ shhh(library(plotly))
shhh(library(DT))
shhh(library(xfun))
shhh(library(hrbrthemes))
# shhh(library(gridExtra))
shhh(library(forcats))
shhh(library(patchwork))
shhh(library(readr))
#shhh(library(dfeshiny))
shhh(library(dfeshiny))


# Functions ---------------------------------------------------------------------------------
Expand Down Expand Up @@ -178,11 +177,10 @@ dfAlevelAps <- data %>%
) %>%
select(
time_period, year, school_type, school_type_group, number_of_students, aps_2016_2023, aps_2013_2015, aps_grade_2016_2023, aps_grade_2013_2015,

characteristic_gender, time_period, year, year_2013_2015, version) %>%

characteristic_gender, time_period, year, year_2013_2015, version
) %>%
mutate(
aps_grade_2016_2023 = as.factor(aps_grade_2016_2023),
aps_grade_2016_2023 = as.factor(aps_grade_2016_2023),
aps_grade_2013_2015 = as.factor(aps_grade_2013_2015),
aps_2016_2023 = round(as.numeric(aps_2016_2023), 2),
aps_2013_2015 = round(as.numeric(aps_2013_2015), 2),
Expand All @@ -191,8 +189,8 @@ dfAlevelAps <- data %>%
school_type_group = as.factor(school_type_group),
version = as.factor(version),
school_type = as.factor(recode(school_type,
"All schools and FE sector colleges" = "All Institutions",
"All state-funded schools and colleges" = "All state-funded"
"All schools and FE sector colleges" = "All Institutions",
"All state-funded schools and colleges" = "All state-funded"
))
)

Expand All @@ -211,8 +209,8 @@ fmDiff <- dfApsGenderGap %>%
mutate(
gender_gap = round(as.numeric(gender_gap), 1),
school_type = as.factor(recode(school_type,
"All schools and FE sector colleges" = "All Institutions",
"All state-funded schools and colleges" = "All state-funded"
"All schools and FE sector colleges" = "All Institutions",
"All state-funded schools and colleges" = "All state-funded"
))
)

Expand All @@ -239,8 +237,8 @@ dfAttainment <- dfAttainmentRaw %>%
version = as.factor(version),
cert_type = as.factor(cert_type),
school_type = as.factor(recode(school_type,
"All schools and FE sector colleges" = "All Institutions",
"All state-funded schools and colleges" = "All state-funded"
"All schools and FE sector colleges" = "All Institutions",
"All state-funded schools and colleges" = "All state-funded"
)),
cert_type = as.factor(recode(cert_type, "Alevel" = "A level"))
) %>%
Expand All @@ -251,14 +249,14 @@ dfAttainment <- dfAttainmentRaw %>%

#############################################################################################################
# Maths Science attainment


dfMsRaw <- read_all_ms_data()

dfMs<-dfMsRaw%>%
mutate(subject=as.factor(subject),
characteristic_gender=as.factor(characteristic_gender),
version=as.factor(version))%>%
filter(!subject %in% c("Five Maths/Science subjects" , "Six Maths/Science subjects", "Total Students"))
#
#
# dfMsRaw <- read_all_ms_data()
#
# dfMs <- dfMsRaw %>%
# mutate(
# subject = as.factor(subject),
# characteristic_gender = as.factor(characteristic_gender),
# version = as.factor(version)
# ) %>%
# filter(!subject %in% c("Five Maths/Science subjects", "Six Maths/Science subjects", "Total Students"))
Loading

0 comments on commit a06511b

Please sign in to comment.