Animating With gganimate

The folks at Jumping Rivers show how to use gganimate to, in this case, track goal differences for Premier League teams:

Now we can see not only when Arsenal picked up points, but when they dropped points as well. For example, on the 27th of August, they got beat by 4 goals as their goal difference shifted from 0 to -4.

We’re not done there! For the gif, we want to be able to display the current status of the team on each day i.e. Champions League (4th or above), Europa League (5th – 7th), Top Half (8th – 10th), Bottom Half (11th – 17th) or Relgations Zone (18th or below). To do this, on each day, we first need to retrieve the order of each team based on their points and goal difference

Click through to see the example.

Related Posts

Donating To The R Foundation

Mark Niemann-Ross explains how you can donate to the R Foundation: I benefit from the work of the R Foundation. They oversee the language, but also encourage a healthy ecosystem. CRAN happens because of them. Updates to R happen because of them. useR! happens because of them. Every day, you and I are the recipients […]

Read More

Timing Means Of Groups With R

John Mount shares some performance measures pitting data.table against various dplyr methods for calculating grouped means: In this reproduction attempt we see:– The dplyr time being around 0.05 seconds. This is about 5 times slower than claimed.– The dplyr sum()/n() time is about 0.2 seconds, about 5 times faster than claimed.– The data.table time being around 0.004 seconds. This is about three times as […]

Read More


September 2018
« Aug Oct »