Yihui Xie (RStudio, Inc)
2016/08/02 @ JSM Chicago
Documentation: http://htmlwidgets.org
<script src=...></script>
<link href=... rel="stylesheet"></link>
includes$in_header
)<script>...</script>
print in the R console (the RStudio viewer or web browser)
widgetFUN(...)
render in R Markdown
```{r fig.width=7, fig.height=4}
widgetFUN(...)
```
# from CRAN
install.packages("htmlwidgets")
# or development version from Github
devtools::install_github("ramnathv/htmlwidgets")
inst/htmlwidgets
directory (JS/CSS dependencies)
htmlwidgets::createWidget()
HTMLWidgets.widget({
name: "FOO",
type: "output",
initialize: function(el, width, height) {
// initialize the element
},
renderValue: function(el, data, instance) {
// render the data in el, e.g.
// $(el).DataTable(data.options);
}
})
Programming, in movies vs in reality
Move on, and develop a widget package!