Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/juba/robservable
Observable notebooks as R htmlwidgets
https://github.com/juba/robservable
htmlwidgets observable r rstats
Last synced: 2 days ago
JSON representation
Observable notebooks as R htmlwidgets
- Host: GitHub
- URL: https://github.com/juba/robservable
- Owner: juba
- Created: 2020-06-11T15:13:18.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-08-30T10:53:35.000Z (6 months ago)
- Last Synced: 2025-02-06T20:57:37.468Z (5 days ago)
- Topics: htmlwidgets, observable, r, rstats
- Language: HTML
- Homepage: https://juba.github.io/robservable/
- Size: 6.92 MB
- Stars: 164
- Watchers: 10
- Forks: 11
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- jimsghstars - juba/robservable - Observable notebooks as R htmlwidgets (HTML)
- awesome-shiny-extensions - robservable - [Observable](https://observablehq.com/) notebooks as R htmlwidgets. (UI Components / Notebooks)
README
[![CRAN status](https://www.r-pkg.org/badges/version/robservable)](https://CRAN.R-project.org/package=robservable)
[![CRAN Downloads](https://cranlogs.r-pkg.org/badges/last-month/robservable)](https://CRAN.R-project.org/package=robservable)
[![Lifecycle: maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html#maturing)
[![R build status](https://github.com/juba/robservable/workflows/R-CMD-check/badge.svg)](https://github.com/juba/robservable/actions)# robservable
This package allows the use of [Observable](https://observablehq.com/) notebooks (or parts of them) as `htmlwidgets` in R.
Note that *it is not an `iframe` embedding a whole notebook* -- cells are `
` 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](https://raw.githubusercontent.com/juba/robservable/master/resources/screencast_0.2.gif)
You'll find more examples and the associated R code in the [robservable gallery](https://juba.github.io/robservable/articles/gallery.html).
## 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, Rmarkdown or Quarto document (as any htmlwidget)## Limitations
> **Warning**: in Quarto documents, you must either use `robservable` or `ojs` cells. Using both in the same document will make at least one of both fail.
- 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:
```r
remotes::install_github("juba/robservable")
```## Usage
For an introduction and examples, see the [introduction to robservable](https://juba.github.io/robservable/articles/introduction.html) vignette.
For a small gallery of interesting notebooks, see the [robservable gallery](https://juba.github.io/robservable/articles/gallery.html) vignette.
For usage in Shiny, see the [robservable in Shiny applications](https://juba.github.io/robservable/articles/shiny.html) vignette (work in progress).
## Development notes
This package uses [packer](https://github.com/JohnCoene/packer) to manage JavaScript source code and dependencies. If you want to modify it, you'll need a working installation of [Node.js](https://nodejs.org/en/).
After cloning this repository, run the following in a terminal at the project root :
```sh
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 :
```r
packer::bundle_dev()
```If you want to ship a minimized production version, use :
```r
packer::bundle_prod()
```