Introduction

This file contains code used to create Figures 1, 2, and 3 and some values for Table 1. We also print out useful underlying data for the plots

Raw code can be downloaded by selecting the Download Rmd option from the Code drop down menu at the top of this page.

Software

R packages and helper functions….

library(tidyverse)
library(curl)
library(readxl)
library(forcats)
library(ggthemes)
library(socviz)
library(here)
#Helper function
`%nin%` <- negate(`%in%`)

#Short cut for csv output with html tables
my_datatable <- function(x){
  DT::datatable(x, extensions = "Buttons", options = list(dom = "Bfrtip", 
                                                          buttons = c("csv")))
}

#Baseline plot settings
theme_set(theme_minimal(base_family = "Roboto", base_size = 20) +
            theme(panel.grid.minor = element_blank(),
                  axis.title.y = element_text(margin = margin(0, 20, 0, 0)),
                  axis.title.x = element_text(margin = margin(20, 0, 0, 0)),
                  plot.caption = element_text(colour = "#AAAAAA"),
                  plot.margin = margin(3,15,3,3,"mm")))

#global options for scientific numbers and significant digits.          
options(scipen = 10,
        digits = 1)

Figure 1

Figure 1 shows the distribution of care home size across the 4 nations with violin and boxplots.

Load in data

The data used to create this plot is derived from information from the relevant Care inspectorates in each nation. These files required some pre-processing which can be found in on this page. The derived, combined, dataset is imaginatively called uk and is found in the derived_data folder as a feather object on the project GitHub pages.

#read in wrangled data to global environment
uk <- feather::read_feather(here("derived_data/uk.feather"))

Plot care homes

Plot all care homes

This plot shows the distribution of all adult care homes in each country, not care homes for older people.

uk %>% 
  ggplot(aes(fct_rev(country), `Care homes beds`, colour = country)) +
  geom_violin(alpha = 0.5) +
  geom_boxplot(width = 0.2) +
  scale_colour_wsj() +
  theme(legend.position = "none",
        plot.caption = element_text(size = 12)) +
  coord_flip() +
  labs(title = "Distribution of care home size",
       subtitle = "(care homes for all adults)",
       x = "",
       y = "Number of care home beds",
       caption = "Outer line indicates distribution\nStrong vertical line in box indicates the median\nBox limits indicate 25th and 75th percentile\nDots indicate statistical outliers\nSources: Care Quality Commission England, Care Inspectorate Scotland,\n Regulation and Quality Improvement Authority Northern Ireland, and the Care Inspectorate Wales\nCode:https://github.com/davidhen/ltc_covid_uk") -> fig_1
fig_1

Plot older people’s care homes

This plot shows the distribution when filtering for older people’s care homes only. We can’t include Wales in this plot as we can’t filter between care home types. See the table below for more info.

uk %>% 
  filter(country != "Wales") %>% 
  filter(case_when(
    country == "England" ~ `Service user band - Older People` == "Y",
    country == "Scotland" ~ Subtype %in% c("Older People", "Respite Care and Short Breaks"),
    country == "Northern Ireland" ~ str_detect(`Categories of Care`, "I") | 
      str_detect(`Categories of Care`, "DE") 
  )) %>%
  ggplot(aes(fct_rev(country), `Care homes beds`, colour = country)) +
  geom_violin(alpha = 0.5) +
  geom_boxplot(width = 0.2) +
  scale_colour_wsj() +
  theme(legend.position = "none",
        plot.caption = element_text(size = 12)) +
  coord_flip() +
  labs(title = "Distribution of care home size",
       subtitle = "(care homes for older adults)",
       x = "",
       y = "Number of care home beds",
       caption = "Outer line indicates distribution\nStrong vertical line in box indicates the median\nBox limits indicate 25th and 75th percentile\nDots indicate statistical outliers\nSources: Care Quality Commission England, Care Inspectorate Scotland,\n Regulation and Quality Improvement Authority Northern Ireland, and the Care Inspectorate Wales\nCode:https://github.com/davidhen/ltc_covid_uk") -> fig_1a
fig_1a

Calculate number of care homes and bed numbers

Some useful summary figures which contribute to Table 1 in the report

All Adult Care Homes

This uses all data in the uk data object

uk %>% 
  group_by(country) %>% 
  summarise(total_number_of_homes = n(),
            total_number_of_beds = sum(`Care homes beds`, na.rm = TRUE)) %>% 
  mutate(total_number_of_beds = as.numeric(total_number_of_beds)) %>% 
  bind_rows(summarise_all(., funs(if(is.numeric(.)) sum(.) else "Total"))) %>% 
  my_datatable(.)

Note 15 care homes in Scotland do not provide total_beds figures.

Care Homes for older people

Care Inspectorate for Wales does not classify care home type by older people so we must remove them from this summary. The code block below shows how we filtered the other nations data to include only care homes for older people. This is subjective and there is no clear documentation or metadata to aid with this. It is also important to note that some care homes may include a mix of older and younger clients.

  • England: Filter on “Service User Band - Older people” option
  • Scotland: using Subtypes “Older People” and “Respite Care and Short Breaks”
  • Northern Ireland: Categories of care including the letters “I” or “DE” (this reflects how Quality Improvement Authority Northern Ireland subset)
uk %>% 
  filter(country != "Wales") %>% 
  filter(case_when(
    country == "England" ~ `Service user band - Older People` == "Y",
    country == "Scotland" ~ Subtype %in% c("Older People", "Respite Care and Short Breaks"),
    country == "Northern Ireland" ~ str_detect(`Categories of Care`, "I") | 
      str_detect(`Categories of Care`, "DE") 
  )) %>% 
  group_by(country) %>% 
  summarise(total_number_of_homes = n(),
            total_number_of_beds = sum(`Care homes beds`, na.rm = TRUE)) %>% 
  my_datatable(.)

Note 10 care homes in Scotland do not provide total_beds figures.

Deaths per 100,000

Data

Data for Figures 2 & 3 is sourced from the ONS Deaths registered in England and Wales available here

To calculate per 100,000 estimates we used population estimates from here and crudely added them in manually in the code as seen below.

#Assign url for ONS data and download into a temporary file
url <- "https://www.ons.gov.uk/file?uri=%2fpeoplepopulationandcommunity%2fbirthsdeathsandmarriages%2fdeaths%2fdatasets%2fweeklyprovisionalfiguresondeathsregisteredinenglandandwales%2f2020/publishedweek282020.xlsx"
temp <- tempfile()
temp <- curl_download(url=url, destfile=temp, quiet=FALSE)


#Extract weekly data for each country from "UK" Worksheet and tidy up
uk_deaths_data <-
  read_xlsx(temp, sheet="UK - Covid-19 - Weekly reg", 
                         range = "A4:AB12") %>% 
  slice(5:8) %>% 
  select(-`Week number`) %>% 
  rename(country = `...2`) %>% 
  #reshape to long format
  pivot_longer(`1`:`26`, names_to = "week_number", 
               values_to = "covid_deaths") %>% 
  #coerce week number to integer
  mutate(week_number = as.integer(week_number)) %>% 
  #drop rows before week 11
  filter(week_number >= 11) %>%
  #coerce country variable to a factor
  mutate(country = factor(country, 
                          levels = c("England", "Scotland", 
                          "Wales", "Northern Ireland")),
         #manually add in population size
         pop = case_when(
           country == "England" ~ 56286961,
           country == "Wales" ~ 3152879,
           country == "Scotland" ~ 5463300,
           country == "Northern Ireland" ~ 1893667),
    #Calculate deaths per 100,000
    deaths_100000 = covid_deaths/pop * 100000)
#Print out the result
uk_deaths_data %>% 
  round_df() %>% 
  my_datatable(.)

Figure 2 Overall deaths

Using the uk_deaths_data object we can summarise and plot out the number of deaths in the whole UK in each week.

uk_deaths_data %>% 
  #summarise the uk deaths data table
  group_by(week_number) %>% 
  summarise(tot_deaths = sum(covid_deaths)) %>% 
  #and pipe into the plot
  ggplot(aes(week_number, tot_deaths)) +
  geom_line(colour = wsj_pal()(1)) +
  scale_x_continuous(breaks = scales::pretty_breaks(n = 12)) +
  scale_y_continuous(breaks = scales::pretty_breaks(),
                     limits = c(0, 10000)) +
  labs(title = "Weekly deaths attributed to COVID-19 in the UK",
       x = "Week number",
       y = "",
       caption = "Source:ONS Deaths registered in England and Wales, UK deaths\nCode:https://github.com/davidhen/ltc_covid_uk") -> fig_2
fig_2

Figure 3 Deaths per 100k

Same data as before but plotting per 100k figures now as opposed to absolute numbers.

uk_deaths_data %>% 
  ggplot(aes(week_number, deaths_100000, colour = country)) +
  geom_line(size = 1.2) +
  scale_colour_wsj() +
  scale_x_continuous(breaks = scales::pretty_breaks(n = 12)) +
  scale_y_continuous(breaks = scales::pretty_breaks()) +
  theme(legend.position = "top") +
  labs(title = "Weekly deaths attributed to COVID-19 per 100,000",
       subtitle = "by UK nation",
       x = "Week number",
       y = "", 
       colour = "",
       caption = "Source:ONS Deaths registered in England and Wales, UK deaths\nCode:https://github.com/davidhen/ltc_covid_uk") -> fig_3
fig_3

Summary figures

Total deaths

A figure referenced in the text of the report - total COVID-19 deaths Weeks 11-26

uk_deaths_data %>% 
  summarise(total_deaths = sum(covid_deaths)) 

per 100k by nation

Useful summary figures

uk_deaths_data %>% 
  group_by(country) %>% 
  summarise(covid_deaths = sum(covid_deaths),
            pop = pop) %>% 
  distinct() %>% 
  mutate(total_per_100k = covid_deaths/pop * 100000) %>% 
  round_df() %>% 
  my_datatable(.)

UK per 100k

More useful summary figures

uk_deaths_data %>% 
  group_by(country) %>% 
  summarise(covid_deaths = sum(covid_deaths),
            pop = pop) %>% 
  distinct() %>% 
  ungroup() %>% 
  summarise(covid_deaths = sum(covid_deaths),
            uk_pop = sum(pop)) %>% 
  mutate(total_uk_deaths_100k = covid_deaths/uk_pop * 100000)

Session Information

devtools::session_info()
## ─ Session info ────────────────────────────────────────
##  setting  value                       
##  version  R version 4.1.0 (2021-05-18)
##  os       macOS Big Sur 11.4          
##  system   aarch64, darwin20           
##  ui       RStudio                     
##  language (EN)                        
##  collate  en_GB.UTF-8                 
##  ctype    en_GB.UTF-8                 
##  tz       Europe/London               
##  date     2021-06-14                  
## 
## ─ Packages ────────────────────────────────────────────
##  package     * version date       lib source        
##  assertthat    0.2.1   2019-03-21 [1] CRAN (R 4.1.0)
##  backports     1.2.1   2020-12-09 [1] CRAN (R 4.1.0)
##  broom         0.7.7   2021-06-13 [1] CRAN (R 4.1.0)
##  bslib         0.2.5.1 2021-05-18 [1] CRAN (R 4.1.0)
##  cachem        1.0.5   2021-05-15 [1] CRAN (R 4.1.0)
##  callr         3.7.0   2021-04-20 [1] CRAN (R 4.1.0)
##  cellranger    1.1.0   2016-07-27 [1] CRAN (R 4.1.0)
##  cli           2.5.0   2021-04-26 [1] CRAN (R 4.1.0)
##  colorspace    2.0-1   2021-05-04 [1] CRAN (R 4.1.0)
##  crayon        1.4.1   2021-02-08 [1] CRAN (R 4.1.0)
##  crosstalk     1.1.1   2021-01-12 [1] CRAN (R 4.1.0)
##  curl        * 4.3.1   2021-04-30 [1] CRAN (R 4.1.0)
##  DBI           1.1.1   2021-01-15 [1] CRAN (R 4.1.0)
##  dbplyr        2.1.1   2021-04-06 [1] CRAN (R 4.1.0)
##  desc          1.3.0   2021-03-05 [1] CRAN (R 4.1.0)
##  devtools      2.4.2   2021-06-07 [1] CRAN (R 4.1.0)
##  digest        0.6.27  2020-10-24 [1] CRAN (R 4.1.0)
##  dplyr       * 1.0.6   2021-05-05 [1] CRAN (R 4.1.0)
##  DT            0.18    2021-04-14 [1] CRAN (R 4.1.0)
##  ellipsis      0.3.2   2021-04-29 [1] CRAN (R 4.1.0)
##  evaluate      0.14    2019-05-28 [1] CRAN (R 4.1.0)
##  fansi         0.5.0   2021-05-25 [1] CRAN (R 4.1.0)
##  farver        2.1.0   2021-02-28 [1] CRAN (R 4.1.0)
##  fastmap       1.1.0   2021-01-25 [1] CRAN (R 4.1.0)
##  feather       0.3.5   2019-09-15 [1] CRAN (R 4.1.0)
##  forcats     * 0.5.1   2021-01-27 [1] CRAN (R 4.1.0)
##  fs            1.5.0   2020-07-31 [1] CRAN (R 4.1.0)
##  generics      0.1.0   2020-10-31 [1] CRAN (R 4.1.0)
##  ggplot2     * 3.3.3   2020-12-30 [1] CRAN (R 4.1.0)
##  ggthemes    * 4.2.4   2021-01-20 [1] CRAN (R 4.1.0)
##  glue          1.4.2   2020-08-27 [1] CRAN (R 4.1.0)
##  gtable        0.3.0   2019-03-25 [1] CRAN (R 4.1.0)
##  haven         2.4.1   2021-04-23 [1] CRAN (R 4.1.0)
##  here        * 1.0.1   2020-12-13 [1] CRAN (R 4.1.0)
##  highr         0.9     2021-04-16 [1] CRAN (R 4.1.0)
##  hms           1.1.0   2021-05-17 [1] CRAN (R 4.1.0)
##  htmltools     0.5.1.1 2021-01-22 [1] CRAN (R 4.1.0)
##  htmlwidgets   1.5.3   2020-12-10 [1] CRAN (R 4.1.0)
##  httr          1.4.2   2020-07-20 [1] CRAN (R 4.1.0)
##  jquerylib     0.1.4   2021-04-26 [1] CRAN (R 4.1.0)
##  jsonlite      1.7.2   2020-12-09 [1] CRAN (R 4.1.0)
##  knitr         1.33    2021-04-24 [1] CRAN (R 4.1.0)
##  labeling      0.4.2   2020-10-20 [1] CRAN (R 4.1.0)
##  lifecycle     1.0.0   2021-02-15 [1] CRAN (R 4.1.0)
##  lubridate   * 1.7.10  2021-02-26 [1] CRAN (R 4.1.0)
##  magrittr      2.0.1   2020-11-17 [1] CRAN (R 4.1.0)
##  memoise       2.0.0   2021-01-26 [1] CRAN (R 4.1.0)
##  modelr        0.1.8   2020-05-19 [1] CRAN (R 4.1.0)
##  munsell       0.5.0   2018-06-12 [1] CRAN (R 4.1.0)
##  patchwork   * 1.1.1   2020-12-17 [1] CRAN (R 4.1.0)
##  pillar        1.6.1   2021-05-16 [1] CRAN (R 4.1.0)
##  pkgbuild      1.2.0   2020-12-15 [1] CRAN (R 4.1.0)
##  pkgconfig     2.0.3   2019-09-22 [1] CRAN (R 4.1.0)
##  pkgload       1.2.1   2021-04-06 [1] CRAN (R 4.1.0)
##  prettyunits   1.1.1   2020-01-24 [1] CRAN (R 4.1.0)
##  processx      3.5.2   2021-04-30 [1] CRAN (R 4.1.0)
##  ps            1.6.0   2021-02-28 [1] CRAN (R 4.1.0)
##  purrr       * 0.3.4   2020-04-17 [1] CRAN (R 4.1.0)
##  R6            2.5.0   2020-10-28 [1] CRAN (R 4.1.0)
##  Rcpp          1.0.6   2021-01-15 [1] CRAN (R 4.1.0)
##  readr       * 1.4.0   2020-10-05 [1] CRAN (R 4.1.0)
##  readxl      * 1.3.1   2019-03-13 [1] CRAN (R 4.1.0)
##  rematch       1.0.1   2016-04-21 [1] CRAN (R 4.1.0)
##  remotes       2.4.0   2021-06-02 [1] CRAN (R 4.1.0)
##  reprex        2.0.0   2021-04-02 [1] CRAN (R 4.1.0)
##  rlang         0.4.11  2021-04-30 [1] CRAN (R 4.1.0)
##  rmarkdown   * 2.8     2021-05-07 [1] CRAN (R 4.1.0)
##  rprojroot     2.0.2   2020-11-15 [1] CRAN (R 4.1.0)
##  rstudioapi    0.13    2020-11-12 [1] CRAN (R 4.1.0)
##  rvest         1.0.0   2021-03-09 [1] CRAN (R 4.1.0)
##  sass          0.4.0   2021-05-12 [1] CRAN (R 4.1.0)
##  scales        1.1.1   2020-05-11 [1] CRAN (R 4.1.0)
##  sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 4.1.0)
##  socviz      * 1.2     2020-06-10 [1] CRAN (R 4.1.0)
##  stringi       1.6.2   2021-05-17 [1] CRAN (R 4.1.0)
##  stringr     * 1.4.0   2019-02-10 [1] CRAN (R 4.1.0)
##  testthat      3.0.2   2021-02-14 [1] CRAN (R 4.1.0)
##  tibble      * 3.1.2   2021-05-16 [1] CRAN (R 4.1.0)
##  tidyr       * 1.1.3   2021-03-03 [1] CRAN (R 4.1.0)
##  tidyselect    1.1.1   2021-04-30 [1] CRAN (R 4.1.0)
##  tidyverse   * 1.3.1   2021-04-15 [1] CRAN (R 4.1.0)
##  usethis       2.0.1   2021-02-10 [1] CRAN (R 4.1.0)
##  utf8          1.2.1   2021-03-12 [1] CRAN (R 4.1.0)
##  vctrs         0.3.8   2021-04-29 [1] CRAN (R 4.1.0)
##  withr         2.4.2   2021-04-18 [1] CRAN (R 4.1.0)
##  xfun          0.23    2021-05-15 [1] CRAN (R 4.1.0)
##  xml2          1.3.2   2020-04-23 [1] CRAN (R 4.1.0)
##  yaml          2.2.1   2020-02-01 [1] CRAN (R 4.1.0)
## 
## [1] /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library
LS0tCnRpdGxlOiAiRmlsZSAyIgphdXRob3I6ICJEYXZpZCBIZW5kZXJzb24iCmRhdGU6ICdgciBmb3JtYXQoU3lzLkRhdGUoKSwgIiVCICVkLCAlWSIpYCcKLS0tCgpgYGB7ciBzZXR1cCwgaW5jbHVkZT1GQUxTRX0Ka25pdHI6Om9wdHNfY2h1bmskc2V0KGVjaG8gPSBUUlVFLAogICAgICAgICAgICAgICAgICAgICAgZmlnLndpZHRoID0gMTIsIGZpZy5oZWlnaHQgPSA5LAogICAgICAgICAgICAgICAgICAgICAgd2FybmluZyA9IEZBTFNFLCBtZXNzYWdlID0gRkFMU0UsCiAgICAgICAgICAgICAgICAgICAgICBjbGFzcy5zb3VyY2U9ImJnLXN1Y2Nlc3MiKQpgYGAKCgoKIyBJbnRyb2R1Y3Rpb24KClRoaXMgZmlsZSBjb250YWlucyBjb2RlIHVzZWQgdG8gY3JlYXRlIEZpZ3VyZXMgMSwgMiwgYW5kIDMgYW5kIHNvbWUgdmFsdWVzIGZvciBUYWJsZS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