Search code examples
rhighchartsr-highcharter

Save and load highcharter graph in R


I would like to be able to save and then load my highcharts graphs created with highcharter in R.

I have tried using the save function in R.

  • 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.
  • I used save(graph1, file="new_graph.rda") then x=load("new_graph.rda"), the object x is a character string called with the value graph1.

I have also tried to use the htmlwidgets::saveWidget(graph1, file="html_graph.html"), and then pull it back in using graph2 = htmltools::includeHTML("html_graph.html") but this just gives me the text html and doesnt render the graph.

I tried to render it using htmlwidgets::createWidget("widget", graph2), but I just get a blank screen.

How can I save and then load in highcharts graphs?


Solution

  • Instead of using x=load("new_graph.rda") try load("new_graph.rda").

    Cheers, Rico