Escalating Life Expectancy

July 18, 2016

(This article was first published on R – Exegetic Analytics, and kindly contributed to R-bloggers)

I’ve added mortality data to the lifespan package. A result that immediately emerges from these data is that average life expectancy is steadily climbing.


> library(lifespan)
> ggplot(deaths, aes(x = year, y = avgage)) +
+   geom_boxplot(aes(group = year, fill = sex)) +
+   facet_wrap(~ sex) +
+   labs(x = "", y = "Average Age at Death") +
+   theme_minimal() + theme(legend.title = element_blank())

The effect is more pronounced for men, rising from around 66.5 in 1994 to 70.0 in 2014. The corresponding values for women are 74.6 and 76.5 respectively. Good news for everyone.

When do most deaths occur? It would seem that the peak lies in Winter, specifically January. There is a broad trough during the Summer months. Fractionally more women die in Winter, whereas slightly more men die during Summer.


To leave a comment for the author, please follow the link and comment on their blog: R – Exegetic Analytics. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)