robservable v0.2.0

0

Monthly downloads

0th

Percentile

Import an Observable Notebook as HTML Widget

Allows loading and displaying an Observable notebook (online JavaScript notebooks powered by <https://observablehq.com>) as an HTML Widget in an R session, 'shiny' application or 'rmarkdown' document.

Readme

Lifecycle: maturing R build status

robservable

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.

example

You'll find more examples and the associated R code in the robservable gallery.

Features

  • Display an entire published or shared notebook as an htmlwidget
  • Display specific cells of a published or shared notebook as an htmlwidget
  • Use R data to update cell values
  • Add observers on cell values to communicate with a Shiny app
  • Use inside Shiny app or Rmarkdown document (as any htmlwidget)

Limitations

  • Named cells can be included by name, but unnamed cells are refenced by their index (1-based), which is sometimes a bit tricky to determine. An alternative is to fork the notebook and name the cell in Observable.

Installation

The package is not on CRAN yet, but you can install the development version with:

remotes::install_github("juba/robservable")

Usage

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).

Functions in robservable

Name Description
to_js_date Convert a Date or POSIXt object to a JS Date format
robservableProxy Send commands to a Proxy instance in a Shiny app
robs_observe Add an observer to a robservable notebook input through robservableProxy
robs_update Update robservable through robservableProxy
robservable-shiny Shiny bindings for robservable
robservable Display an Observable notebook as HTML widget
No Results!

Vignettes of robservable

Name
gallery.Rmd
introduction.Rmd
shiny.Rmd
No Results!

Last month downloads

Details

Type Package
Date 2020-09-23
VignetteBuilder knitr
URL https://juba.github.io/robservable/
BugReports https://github.com/juba/robservable/issues
License GPL (>= 3)
Encoding UTF-8
LazyData true
RoxygenNote 7.1.1
NeedsCompilation no
Packaged 2020-09-28 07:25:38 UTC; julien
Repository CRAN
Date/Publication 2020-09-30 09:00:02 UTC

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/robservable)](http://www.rdocumentation.org/packages/robservable)