This functions loads in, cleans, and munges published mortality rates by age from the Office of National Statistics. The data required can be downloaded here

clean_and_munge_england_life_expectancy(life_tables_path = "~/data/tb_data/UK_demographics/england_life_tables.xls",
  sheets = paste0(seq(2013, 1998, -1), "-", seq(2015, 2000, -1)),
  return = TRUE, save = TRUE, save_name = "england_mortality_rates",
  save_path = "~/data/tb_data/tbinenglanddataclean",
  save_format = c("rds", "csv"), verbose = TRUE,
  theme_set = theme_minimal)

Arguments

life_tables_path

The file path to the unformated life tables data as a single xls sheet.

sheets

A character vector of the names of the sheets to import, by default this will import all data 1999-2015.

return

Logical, defaults to TRUE. Specifies whether to return cleanded data.

save

Logical, defaults to FALSE. Specifies whether to save data

save_name

A character string contaning the file name for the data to be saved under.

save_path

The filepath for the data to be saved in

save_format

A character vector specifying the format/formats to save the data into, defaults to rds. Currently csv is also supported. See save_data for details.

verbose

A logical indicating whether summary information should be provided.

theme_set

The ggplot theme to apply to the summary graphs, defaults to theme_minimal

Value

A Tidy data frame containing age specific mortality rates for england between 1999 and 2015.

Examples