title: HighCharts Sankey Diagram in R
body: <p>I'd like to create a sankey diagram using the highcharter library in R. Usually I'm just able to look at the javascript code for the plot and translate it for R, but for sankey plots I'm having some trouble. I'd like to just start by creating something like this: <a href="http://jsfiddle.net/highcharts/z2rL672w/3/" rel="nofollow noreferrer">http://jsfiddle.net/highcharts/z2rL672w/3/</a></p>
  
  <p>Here's my attempt so far. I'm having trouble where to place the "keys" argument.</p>
  
  <pre><code>highchart() %&gt;%
    hc_chart(type='sankey') %&gt;%
    hc_add_series_list(
      list(
        keys=c('from', 'to', 'weight')
      ),
      list(
        data=list(
          list(
            from='AT',
            to='DE',
            weight=10
          ),
          list(
            from='DE',
            to='CH',
            weight=5
          ),
          list(
            from='DE',
            to='FI',
            weight=5
          )
        )
      )
    )
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>I'm now trying the following. Still having a bit of trouble</p>
  
  <pre><code>library(highcharter)
  library(tidyverse)
  library(jsonlite)
  
  dat &lt;- data.frame(from=c('AT', 'DE', 'CH', 'DE'),
                     to=c('DE', 'CH', 'DE', 'FI'),
                     weight=c(10, 5, 15, 5)) %&gt;%
    toJSON()
  
  highchart() %&gt;%
    hc_chart(type='sankey') %&gt;%
    hc_series(dat)
  </code></pre>