Producing a Sankey diagram with the networkD3 package
A Sankey diagram is a really powerful way of displaying your data. Particularly, Sankey diagrams are a really convenient way of showing flows of data from their origin to their end.
A really famous example of these kind of diagrams is the one presented by Charles Minard's 1869 chart showing the number of men in Napoleon's 1812 Russian campaign army, their movements, as well as the temperature they encountered on the return path:
In a Sankey diagram, a given amount is shown on the leftmost side of the plot and, while moving to the right (which can be interpreted as the flow of time), this given amount is split into parts or simply reduced. The latter is the case for the Minard's diagram, where soldiers died during the campaign and the number of deaths are counted in a separate line plot at the bottom.
Getting ready
In order to get started with this...