To convert D3 to SVG, I believe all you need is a helper function but that is not my area of expertise.
Also there is ggvis https://github.com/rstudio/ggvis which is nice if you are already using ggplot2.
output.append('div').text(svg.node().outerHTML);
You can see it in action here:
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="250" height="250"><rect x="25" y="25" width="200" height="200" fill="lime" stroke-width="4" stroke="pink"></rect><circle cx="125" cy="125" r="75" fill="orange"></circle><polyline points="50,125 50,200 200,200 200,125" stroke="red" stroke-width="4" fill="none"></polyline><path d="M50 125 c 25 -60 50 -60 75 0 c 25 60 50 60 75 0" fill="none" stroke-width="4" stroke="white"></path><text x="125" y="125" font-family="monospace" font-size="20" text-anchor="middle" fill="black">Hello world</text></svg>
A simple
d3.select('svg').node().outerHTML
would do the trick.
(You can use the same trick as in console-save to generate a download URL though.)
It's pretty easy to use. I don't do interactive so I just find it easier to export EPS files from R.