How to save the ggvis graph displayed in the Viewer RStudio panel with R script?

I am using ggvis with RStudio. For instance:

library(ggvis)
mtcars %>% ggvis(~mpg, ~wt) %>% layer_points()

Then what happens is that a (static) diagram is displayed in the Viewer RStudio panel. In this panel, I can click the Export button to save the chart as .png, but is there a way to do this on the command line? (so not by hand)

I know that ggvis has a function export_png, but it only works with node.js, and I have problems with it (I am on Windows, and I can’t even run the node.js installer on my computer, but this is a separate issue that I will discuss separately).

So my question is: is there a way to capture in a .png file with an R script, which is displayed in the Viewer panel?

Or: is there a way other than export_pngsaving the ggvis diagram as a .png file?

Thanks in advance.

sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: i386-w64-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252    LC_MONETARY=French_France.1252 LC_NUMERIC=C                  
[5] LC_TIME=French_France.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ggvis_0.4

loaded via a namespace (and not attached):
 [1] assertthat_0.1  DBI_0.3.1       digest_0.6.8    dplyr_0.4.1     htmltools_0.2.6 httpuv_1.3.2    magrittr_1.5    mime_0.2        parallel_3.1.2 
[10] R6_2.0.1        Rcpp_0.11.4     RJSONIO_1.3-0   shiny_0.11      tools_3.1.2     xtable_1.7-
+4
source share

All Articles