title: How to capture html output as png in R
body: <p>I use interactive output created by networkD3 package in R. I know how to save the output as html page, but I also need to save the 'static' version of the diagram as .png file.</p>
  
  <p>The code looks like this:</p>
  
  <pre><code># Load package
  library(networkD3)
  
  # Create fake data
  src &lt;- c("A", "A", "A", "A", "B", "B", "C", "C", "D")
  target &lt;- c("B", "C", "D", "J", "E", "F", "G", "H", "I")
  networkData &lt;- data.frame(src, target)
  
  # Plot
  simpleNetwork(networkData)
  </code></pre>
  
  <p>I can save the output by clicking on 'Export' and then 'Save as Image'. However, I prefer to use some commands in my code to save the picture.</p>