6

I saved some graphs from a script as an html object using:

 htmlwidgets::saveWidget(p,"graph.html"))

Is it possible to read this object back into R? I can't find anything in the htmlwidgets documentation: https://cran.r-project.org/web/packages/htmlwidgets/htmlwidgets.pdf

for opening or reading back in the object in R?

LoF10
  • 1,907
  • 1
  • 23
  • 64
  • 1
    why not save the object as an rdata file also? E.g. `save(p, "graph.rda") – emilliman5 Dec 07 '16 at 15:55
  • I'm not familiar with that way of saving the object. So would I be able to then read in a serious of rda objects into the same environment and work with them? Appreciate the help. – LoF10 Dec 07 '16 at 15:58
  • Yes, exactly, you can even save multiple objects into one Rda, if I am not mistaken. Look at `?save` and `?load` – emilliman5 Dec 07 '16 at 16:00
  • I'll take a look. Appreciate the help! – LoF10 Dec 07 '16 at 16:03
  • technically it would be possible to get close from your saved html, but there is no convenient mechanism for doing so. I agree with emilliman5 that rda or similar is your best way of serializing/saving the htmlwidget for future use. htmlwidgets are just lists. – timelyportfolio Dec 07 '16 at 19:29
  • When I load the RDA object into R it just gives me the name of the object as a string rather than the object it self. `save(graph1, file="new_graph.rda")` then `x=load("new_graph.rda"), the object x is a character string called with the value `graph1` – Laurence_jj Dec 02 '19 at 11:51

0 Answers0