Skip to content

cpsievert/widgetHub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Just a repo for hosting an htmlwidget for debugging purposes. Here I how I use it:

save_widget <- function(x, dir = ".") {
  dir <- normalizePath(dir, mustWork = T)
  owd <- setwd(dir)
  on.exit(owd, add = T)
  if (inherits(x, "plotly")) x <- plotly::as.widget(x)
  htmlwidgets::saveWidget(x, file = "index.html", selfcontained = FALSE)
}

library(plotly)
p <- plot_ly()
save_widget(p, "../widgetHub")