Interpolate your data for animation in R

Posted to Coding  |  Tags: , ,  |  Nathan Yau

The tweenr package in R, by Thomas Lin Pedersen, helps you interpolate data for easier animated transitions.

tweenr is a small package that makes it easy to interpolate your data between different states, specifying the length of each change, the easing of the transition and how many intermediary steps should be generated. tweenr works particularly well with gganimate but can be used for any case where interpolation of data is needed.

Why I’m just now learning about this, I have no clue. I thought we were friends.


Life expectancy changes

The data goes back to 1960 and up to the most current estimates for 2009. Each line represents a country.

How We Spend Our Money, a Breakdown

We know spending changes when you have more money. Here’s by how much.

The Most Unisex Names in US History

Moving on from the most trendy names in US history, let’s look at the most unisex ones. Some names have …

Years You Have Left to Live, Probably

The individual data points of life are much less predictable than the average. Here’s a simulation that shows you how much time is left on the clock.