knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
# set seed for reproducible widget id
if (requireNamespace("htmltools", quietly = TRUE)) {
  htmlwidgets::setWidgetIdSeed(42)
}

Widgets in pkgdown sites

htmlwidgets in pkgdown sites need special treatment for some site components.

leaflet

library(leaflet)
  leaflet() %>%
  addTiles() %>%
  addMarkers(
  lng=174.768,
  lat=-36.852,
  popup="The birthplace of R"
)

heatmaply

library(heatmaply)
heatmaply(mtcars, k_row = 3, k_col = 2)

plotly

library(plotly)
plot_ly(midwest,
  x = ~percollege,
  color = ~state,
  type = "box"
)

DiagrammeR

library(DiagrammeR)
grViz("
  digraph {
    layout = twopi
    node [shape = circle]
    A -> {B C D} 
  }")


jayhesselberth/widgetdown documentation built on May 7, 2019, 8:43 a.m.