This package allows the use of Observable notebooks (or parts of them) as htmlwidgets
in R.
Note that it is not an iframe
embedding a whole notebook – cells are <div>
included directly in your document or application. You can choose what cells to display, update cell values from R, and add observers to cells to get their values back into a Shiny application.
The following GIF shows a quick example of reusing a bar chart race notebook inside R with our own data.
You’ll find more examples and the associated R code in the robservable gallery.
htmlwidget
htmlwidget
Warning: in Quarto documents, you must either use
robservable
orojs
cells. Using both in the same document will make at least one of both fail.
The package is on CRAN, but you can also install the development version with:
remotes::install_github("juba/robservable")
For an introduction and examples, see the introduction to robservable vignette.
For a small gallery of interesting notebooks, see the robservable gallery vignette.
For usage in Shiny, see the robservable in Shiny applications vignette (work in progress).
This package uses packer to manage JavaScript source code and dependencies. If you want to modify it, you’ll need a working installation of Node.js.
After cloning this repository, run the following in a terminal at the project root :
Then, if you modify the JavaScript code in srcjs
, you’ll have to run the following command to bundle and update the widget JavaScript code :
packer::bundle_dev()
If you want to ship a minimized production version, use :
packer::bundle_prod()