Reputation:
I would like to save the plots produced in R as HTML. I have used the following code
htmlwidgets::saveWidget(df, "test.html")
But, I could not save it, and I got the following message:
Error in system.file (config, pakage=pakage) : 'package' must be of length 1
Is it possible to save file as HTML?
Upvotes: 0
Views: 1767
Reputation: 788
As J.D.Currie suggested, you must have an html widget, or in other words, htmlwidget
class object (or any inherited class). You can get the class of your plot by class(df)
to see whether they are htmlwidgets or not. In case your plots are not htmlwidget
, you want to produce interactive graphs and export them as .html; there is a variety of packages for it, such as, plotly
,highcharter
,dygraphs
and so on.
Upvotes: 1
Reputation: 39
From the wording of the question, it doesn't read like you've created a widget object (you say 'plots' and then use 'df' as an argument), which would be done first. In the case of saveWidget(), you're passing at least a widget object and the file name you wish to create.
Read the package documentation.
Also look at the basic tutorial.
Upvotes: 0