Skip to main content

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

  1. Make sure you have the most recent version of Quarto (>= 1.11.9).
  2. Checkout the source code and load it into RStudio.
  3. Then open a terminal, make sure you are in the right folder, and install the quarto-webr extension:
quarto add coatless/quarto-webr
  1. then render the Quarto page from the menu or from the terminal with:
quarto render index.qmd
  1. Finally, open it in a compatible browser (e.g. Chrome) or upload it to your favorite web server.

4. Further reading

Source code of this example: https://github.com/tpetzoldt/dynamic-R-models/


Copyright and original author: tpetzoldt, 2026-11-08