MyNixOS website logo
Description

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.

CRAN status CRAN Downloads 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.
  • No offline support : the included notebooks have to be downloaded each time they are used.

Installation

The package is on CRAN, but you can also 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).

Development notes

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 :

npm install

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()
Metadata

Version

0.2.2

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows