Skip to content Skip to sidebar Skip to footer

R: Saving Multiple Html Widgets Together

I am using the R programming language. I am interested in learning how to save several 'html widgets' together. I have been able to manually create different types of html widgets:

Solution 1:

If format doesn't matter too much, you can merge the widgets using tagList and save them directly:

htmltools::save_html(tagList(widget_1, widget_2, widget_3, widget_4), file = "C://Users//Me//Desktop//widgets.html")

(It goes without saying that you will need to edit the filepath!)

If you want to control the layout of the widgets, you can wrap each in a div, and then style those:

doc <- htmltools::tagList(
  div(widget_1, style = "float:left;width:50%;"),
  div(widget_2,style = "float:left;width:50%;"),
  div(widget_3, style = "float:left;width:50%;"),
  div(widget_4, style = "float:left;width:50%;")
)

htmltools::save_html(html = doc, file = "C://Users//Me//Desktop//widgets.html")

Post a Comment for "R: Saving Multiple Html Widgets Together"