# Relative age-standardised mortality

## Analysis from the Office for National Statistics compares European nations.

In my co-written book *Covid by Numbers*, a graph shows relative age-standardised mortality. **The graph in the book has a production error, where the UK lines do not have correct alignment. **The original version, made in R, looks like:

**What are relative age-standardised mortality rates? **To calculate age-standardised mortality, we need to find mortality rates within age groups. Next, analysts calculate the weighted average of these age-specific rates. The weights come from a standard population, here: the 2013 European Standard population. This index is then

**The Office for National Statistics updated their ****analysis****.** Now, we can update this graph. In the original version, I uploaded a spreadsheet containing the mortality statistics. This time, I want to draw straight from the online file. That helps make the code more reproducible.

To achieve that goal, I use the curl package:

`temp <- tempfile()`

temp <- curl_download(url = ons_rasmr_url, destfile = temp,

quiet = TRUE, mode = "wb")

ons_rasmr_tbl <- read_excel(temp,

sheet = ons_rasmr_sheet,

range = ons_rasmr_range)