Interactives

Column

Filters

Column

Map

Datatable

Information

How to

Filters

  • The map markers and the data in the table on the ‘Interactives’ page will automatically update based on your selections from the filter boxes, sliders and checkboxes
  • You can select multiple options from within each dropdown list of the filter boxes
  • To remove a selection from a dropdown box, click on it and press delete
  • Note that the dropdown menus aren’t linked (i.e. the local authority dropdown will show all options regardless of how many regions are selected)

Map tab

  • You can select multiple points from the map with the resizable selection tool (button in upper left of map below the zoom buttons), which you can reposition by clicking and dragging the grid icon in it’s upper left corner
  • Click markers to get a popup with information about that point
  • You can measure distances and areas: hover over the button in the upper right of the map, click ‘Create new measurement’ and add points to the map to start creating a measurement

Datatable tab

  • You can click rows of the datatable to highlight those markers on the map
  • Deselect highlighted rows by clicking them again

About

Disclaimer

Teaching schools

The purpose of the National College for Teaching & Leadership (from their About us page) is ‘to improve academic standards by recruiting and developing a workforce to meet the needs of our school system, and to help schools to help each other to improve.’ See ‘Teaching schools and system leadership: how you can get involved’ on GOV.UK.

Code

The underlying code is available on GitHub. You can see a preview by clicking the ‘Source code’ button in the upper right of this page.

Tools

Version details

Version 0.2, generated 16 May 2018

---
title: "Teaching schools in England"
author: "Matt Dray"
output:
  flexdashboard::flex_dashboard:
    theme: paper
    source_code: embed
    favicon: img/mortar.png
---

```{r setup, include=FALSE}
# packages

library(crosstalk)  # inter-widget interactivity
library(dplyr)  # data manipulation and pipes (%>%)
library(leaflet)  # map widget
library(DT)  # datatable widget

# data

# pre-prepared spatial points dataframe
# @data slot is NCTL data with selected GIAS data joined
# @coords slot is latlongs reprojected from eastings/northings in GIAS data 
# NCTL: http://apps.nationalcollege.org.uk/s2ssd_new/index.cfm 
# GIAS: https://get-information-schools.service.gov.uk/ 

schools_spdf <- readRDS("output/schools_spdf.RDS") 

# tidy up a bit

schools_df <- dplyr::bind_cols(
  schools_spdf@data,
  as.data.frame(schools_spdf@coords)
) %>% 
  dplyr::mutate(
    num_pupils = as.numeric(num_pupils),
    ofsted_rating = forcats::fct_explicit_na(ofsted_rating),
    ofsted_rating = forcats::fct_relevel(
      ofsted_rating,
      c("Outstanding", "Good", "Requires improvement")
    )
  ) %>% 
  select(
    urn,
    teaching_school,
    region,
    local_authority,
    alliance_name,
    phase.y,
    type,
    ofsted_rating,
    last_ofsted_date,
    num_pupils,
    latitude,
    longitude
  )

# create crosstalk shared data object (https://rstudio.github.io/crosstalk/)

sd <- SharedData$new(schools_df)
```

Interactives {data-icon="ion-stats-bars"}
=====================================  

Column {data-width=250}
-------------------------------------

### Filters

```{r filters}
# crosstalk filters, sliders, selection
# https://rstudio.github.io/crosstalk/index.html

crosstalk::bscols(
  list(
    filter_select(
      id = "region",
      label = "Region",
      sharedData = sd,
      group = ~region
    ),
    filter_select(
      id = "local_authority",
      label = "Local authority",
      sharedData = sd,
      group = ~local_authority
    ),
    filter_select(
      id = "alliance",
      label = "Alliance",
      sharedData = sd,
      group = ~alliance_name
    ),
    filter_select(
      id = "phase",
      label = "Phase",
      sharedData = sd,
      group = ~phase.y
    ),
    filter_select(
      id = "type",
      label = "Type",
      sharedData = sd,
      group = ~type
    ),
    filter_checkbox(
      id = "ofsted",
      label = "Ofsted rating",
      sharedData = sd,
      group = ~ofsted_rating,
      inline = TRUE,
      columns = 2
    ),
    filter_slider(
      id = "pupil_count",
      label = "Pupil count",
      sharedData = sd,
      column = ~num_pupils,
      step = 10,
      round = TRUE,
      sep = "",
      ticks = FALSE
    )
  )
)
```

Column {.tabset .tabset-fade data-width=750}
-------------------------------------

### Map
    
```{r map}
leaflet::leaflet(sd) %>%
  leaflet::addProviderTiles(providers$OpenStreetMap) %>% 
  leaflet::addAwesomeMarkers(
    popup = ~paste0(  # the popup contains a html table
      "
", teaching_school, "
", "
URN ", urn, "
Region ", region, "
Local authority ", local_authority, "
Alliance ", alliance_name, "
Phase ", phase.y, "
Type ", type, "
Pupil count ", num_pupils, "
Ofsted rating ", ofsted_rating, "
" ), icon = awesomeIcons( library = "ion", icon = "ion-record", iconColor = "white", markerColor = "blue" ) ) %>% leaflet::addMeasure() ``` ### Datatable ```{r} # DT package for htmlwidgets datatables # https://rstudio.github.io/DT/options.html DT::datatable( data = sd, # shared data object #filter = "top", # column filter boxes extensions = c("Scroller", "Buttons"), # scroll instead of paginate rownames = FALSE, # remove row names style = "bootstrap", # style width = "100%", # full width class = "compact", options = list( deferRender = TRUE, # scroll scrollY = 300, scroller = TRUE, # button autoWidth = TRUE, # column width consistent when making selections dom = "Blfrtip", buttons = list( list( extend = "collection", buttons = c("csv", "excel"), # download extension options text = "Download" # text to display ) ) ), colnames = c( "URN" = "urn", "School" = "teaching_school", "Region" = "region", "Local Authority" = "local_authority", "Alliance" = "alliance_name", "Phase" = "phase.y", "Type" = "type", "Ofsted" = "ofsted_rating", "Pupil count" = "num_pupils" ) ) ``` Information {data-orientation=rows data-icon="fa-info-circle"} ===================================== ### How to #### Filters * The map markers and the data in the table on the 'Interactives' page will automatically update based on your selections from the filter boxes, sliders and checkboxes * You can select multiple options from within each dropdown list of the filter boxes * To remove a selection from a dropdown box, click on it and press delete * Note that the dropdown menus aren't linked (i.e. the local authority dropdown will show *all* options regardless of how many regions are selected) #### Map tab * You can select multiple points from the map with the resizable selection tool (button in upper left of map below the zoom buttons), which you can reposition by clicking and dragging the grid icon in it's upper left corner * Click markers to get a popup with information about that point * You can measure distances and areas: hover over the button in the upper right of the map, click 'Create new measurement' and add points to the map to start creating a measurement #### Datatable tab * You can click rows of the datatable to highlight those markers on the map * Deselect highlighted rows by clicking them again ### About #### Disclaimer * This was built independently and not on behalf of NCTL * Only schools with co-ordinates listed in [Get Information About Schools](https://get-information-schools.service.gov.uk/) could be mapped * This tool is not a replacement for the official [Teaching schools](http://apps.nationalcollege.org.uk/s2ssd_new/index.cfm) service #### Teaching schools The purpose of the [National College for Teaching & Leadership](https://www.gov.uk/government/organisations/national-college-for-teaching-and-leadership) (from their [About us](https://www.gov.uk/government/organisations/national-college-for-teaching-and-leadership/about) page) is 'to improve academic standards by recruiting and developing a workforce to meet the needs of our school system, and to help schools to help each other to improve.' See ['Teaching schools and system leadership: how you can get involved'](https://www.gov.uk/government/collections/teaching-schools-and-system-leadership-how-you-can-get-involved) on GOV.UK. #### All data are published * [Teaching schools](http://apps.nationalcollege.org.uk/s2ssd_new/index.cfm) from [NCTL](https://www.gov.uk/government/organisations/national-college-for-teaching-and-leadership) * [Local authority boundaries](http://geoportal.statistics.gov.uk/datasets/local-authority-districts-december-2017-ultra-generalised-clipped-boundaries-in-united-kingdom-wgs84) from the [ONS Open Geography Portal](http://geoportal.statistics.gov.uk/) * [Get Information About Schools](https://get-information-schools.service.gov.uk/) from the [Department for Education](https://www.gov.uk/government/organisations/department-for-education) #### Code The underlying code is available on [GitHub](https://github.com/matt-dray/nctl-teaching-schools). You can see a preview by clicking the 'Source code' button in the upper right of this page. #### Tools * [Leaflet](https://rstudio.github.io/leaflet/) map widget and [DT](https://rstudio.github.io/DT/options.html) table widget * [Crosstalk](https://rstudio.github.io/crosstalk/) for inter-widget interactivity and selection tools * [Flexdashboard](https://rmarkdown.rstudio.com/flexdashboard/) for the layout #### Version details Version 0.2, generated `r format(Sys.time(), "%d %B %Y")`