Reactive notebooks for R
This is experimental software. There are bugs, and the API is liable to change without maintaining backwards compatibility.
What is it?
Reactor notebooks are collections of cells containing R code. When you update a cell, all of the cells that reference it are automatically updated, like how a spreadsheet works. Reactor notebooks integrate R code, plots, HTML, and markdown into one document.
Reactor notebooks are useful for prototyping code and exploring subjects through interactive visualizations.
The demo video on YouTube shows how to use Reactor to build a simple interactive notebook:
Install and load
Create a new notebook and launch the Reactor server:
# Create new Reactor notebook notebook <- ReactorNotebook$new() # Launch server at http://localhost:5000 server <- start_reactor(notebook)
Save progress and stop the server:
# Save progress notebook$save("./notebook.rds") # Stop server stop_reactor(server)
Load the notebook later to start where you left off:
# Load notebook notebook <- ReactorNotebook$load("./notebook.rds")
Reactor includes an example notebook:
# Load Gaussian Process example notebook notebook <- reactor_example("gaussian_processes.Rmd") server <- start_reactor(notebook)
You can also see and interact with the example notebook running as a Shiny application.
If a cell is used to define a variable, Reactor keeps track of all the other cells that depend on it. If you update the variable, all the dependent cells are rerun.
Interactive inputs can be used to set the value of an R variable.
Reactor supports base plots and ggplot2.
Any R variable with the class "htmlwidget" will be rendered as HTML.
Saves to Rmd
Run as Shiny
Reactor notebooks can be run as Shiny applications, making it easy to deploy notebooks online for sharing with others. See
vignette("shiny_deployment") for an example of deploying a notebook to shinyapps.io.
- View documentation in a side panel by calling it up from a cell (e.g.
?lm) or the shortcut Ctrl-Shift-?.
- Export notebooks to R scripts, with the cells rearranged to run from top to bottom.
Comparison to existing tools
|Jupyter||Various||For Python with dfkernel|
- export to R script
- export to HTML
- run in shiny
- HTML inputs: