Stephen Wade
May 2016
Provides long-form lifetable datasets in R which are currently sourced from:
| Source | R name | Copyright |
|---------------------------------|----------|----------------------------------|
| Australian Bureau of Statistics | abs_lt
| © Commonwealth of Australia |
Use of any of these data sources should be attributed/cited as per the instructions provided by the original source given in the preceding table.
The data is in long form which is identified by sex, age, location, year and
the quantity type e.g. lx
or qx
and so on. In R the data looks like:
library(lifetable)
head(abs_lt)
sex measure age value loc year
1 M lx 0 100000.00 AU 2002
2 M lx 1 99467.41 AU 2002
3 M lx 2 99420.44 AU 2002
4 M lx 3 99392.67 AU 2002
5 M lx 4 99369.61 AU 2002
6 M lx 5 99351.11 AU 2002
From R (using github installation via devtools):
library(devtools)
install_github('stephematician/lifetable')
To select the Queensland 2010-2012 lifetable from the ABS dataset, abs_lt
:
qld_2010 <- select_lifetable(abs_lt, 2010, 'QLD')
head(qld_2010)
measure sex age value
1 lx F 0 100000
2 lx F 1 99554
3 lx F 2 99526
4 lx F 3 99503
5 lx F 4 99487
6 lx F 5 99475
The ABS website provides explanatory notes for all their Australian lifetable data (link).
One important constraint is that the pre-2009 data is not broken bown by state and territory, whereas 2010 onwards data provides a national lifetable as well as individual state and territory lifetables.
The lifetable data was downloaded from the following ABS web-pages accessed on 12-13th May 2016 for data up to 2012--2014:
The final files in the data-raw/abs directory were manually modified for
the purpose of loading and creating the final ABS dataset: abs_lt
.
Some raw files were renamed to match the later file-name convention:
3302055001.xls
3302055001_2002-2004.xls
3302055001.xls
3302_0_55_001_2006.xls
3302055001DO001_20062008.xls
3302055001DO001_20092011.xls
The 2001-2003 and 2003-2005 files were in an old unsupported Excel format (version 5.0) and so was 'saved as' in Excel 97-2003 Workbook (.xls) format.
Some values for the 100 and over Lx measurement were given as (a)9654
in
order to refer to a footnote. The (a)
is not part of the number and was
manually edited out so that the number could be read into R.
The Excel file for 2004-2006 was large due to a high number of empty rows,
these were removed via the delete cells
option.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.