Test of deSolve in webR
1. About webR and this example
What is webR?
webR is a version of the R interpreter compiled to WebAssembly, that runs entirely in the web browser — no server, no installation, no R setup required. It allows to run R code, load packages, and create graphics interactively on any device with a modern browser. Packages are provided as pre-compiled WebAssembly binaries from the r-wasm package repository.
The example
This example demonstrates that deSolve, a package for numerical solution of differential equation models, now runs in webR as well. It simulates the classic Lorenz system — a benchmark example of deterministic chaos — and visualizes the result as time series and in a 3-dimensional phase space plot.
2. How to use it
This example should run directly in your web browser.
- Wait until webR is initialized and the packages are installed (this may take a moment on first load).
- Press the run button of the code cell, or modify the code first and then run it to explore the model.
3. How to compile it
- Make sure you have the most recent version of Quarto (>= 1.11.9).
- Checkout the source code and load it into RStudio.
- Then open a terminal, make sure you are in the right folder, and install the quarto-webr extension:
quarto add coatless/quarto-webr
- then render the Quarto page from the menu or from the terminal with:
quarto render index.qmd
- Finally, open it in a compatible browser (e.g. Chrome) or upload it to your favorite web server.
4. Further reading
- webR — official documentation: how webR works, its communication channels, and how to embed it in web pages.
- r-wasm package repository: pre-compiled WebAssembly binaries of R packages, including deSolve.
- quarto-webr extension: the community-developed Quarto extension used in this example, which enables interactive webR code cells in HTML documents, Revealjs slides, websites, blogs, and books.
- Making your first webR-powered Quarto document: a step-by-step tutorial covering installation, rendering, and document-level customizations of the quarto-webr extension.
- deSolve on CRAN: documentation and vignettes of the deSolve package for numerical solving of differential equations.
Source code of this example: https://github.com/tpetzoldt/dynamic-R-models/
Copyright and original author: tpetzoldt, 2026-11-08