IN THIS POST WE’RE GOING TO REVISE the dotplot code I posted that lets you take the Federal Open Market Commitee (FOMC) projections and turn them into an animated dotplot.
The problem is that the code I posted was for projections through June 2016 that only provided annual projections for 2016, 2017, and 2018, but the FOMC added 2019 in their September and December 2016 projections.
My original code was hard coded to only handle projections for 3 years and longer-run and now a 4th year was added. Of course, everything broke.
In the original code I relied on the fact that the input data, projections from a quarter, would have the same number of rows. But adding in 2019 results in additional rows for the extra year. For an individual plot this wouldn’t be a problem, but it creates an issue for tweenr because it requires the same number of rows in each data set we’re interpolating.
The simple fix I came up with is to pad the datasets for March and June 2016 to account for the missing 2019 projections. I set it up so the dots fly “down” (as opposed to up which I reserved for the St Louis Fed president).
First, as before we’ll load the data which I’ve stored in individual text files described in my earlier post.
Now that we have the data we can pad the extra rows we need for March (df3) and June (df6).
Now, equipped with this solution we can construct our plot:
Alternatively, we could have just dropped 2019 from the graph and things would have been easier: