WebR – R in the Browser

by siesteon 8/19/2025, 2:36 PMwith 34 comments

by staredon 8/23/2025, 12:17 PM

If you want to use it to create ggplot2 charts, here is an open source demo: https://github.com/QuesmaOrg/demo-webr-ggplot/

I created it as a side project from using WebR to execute code LLM-generated code (https://quesma.com/blog-detail/sandboxing-ai-generated-code-...). While we migrated away from it, I saw that WebR is cool, and I wanted to share it with you.

by ants_everywhereon 8/23/2025, 2:12 PM

I really like R. I find it a nice language to work in. I'm glad to see projects like this that make it more accessible.

by georgestaggon 8/23/2025, 4:58 PM

Here’s a ggplot2 example: https://webr.sh/#code=eJxtkLFOwzAQhsWapzh5ckSUpEgsSBkY2RAVrN...

by nomilkon 8/23/2025, 1:24 PM

What does this mean in practice? Does this mean you could start with a blank .html file, and use html, css, and javascript (like normal), but then somehow run R too? e.g. to generate a ggplot using the browser (as opposed to server, as a shiny app may)?

Has anyone got a minimal reproducible examples (e.g. tiny html file that runs, say 2 * 2 in R)? The example linked to in the article has the key line <script type="module" src="repl.mjs"></script>, but that mjs file goes over my head.

Curious/eager/excited to know/see what kinds of real-world applications this has.

by westurneron 8/23/2025, 10:43 PM

Jupyterlite-xeus compiles jupyterlab to WASM.

jupyterlite-xeus builds jupyterlite, Jupyter xeus kernels, and the specified dependencies to WASM with packages from conda-forge or emscripten-forge.

The jupyterlite-xeus docs say that the xeus-r kernel is already supported: https://github.com/jupyterlite/xeus

jupyter-xeus/xeus-r: https://github.com/jupyter-xeus/xeus-r

emscripten-forge/recipes already has packages for "r-askpass, r-base, r-base64enc, r-bit, r-bit64, r-cachem, r-cli, r-colorspace, r-data.table, r-digest, r-dplyr, r-ellipsis, r-fansi, r-farver, r-fastmap, r-ggrepel, r-glue, r-haven, r-hexbin, r-htmltools, r-isoband, r-jsonlite, r-later, r-lattice, r-lazyeval, r-magrittr, r-mass, r-matrix, r-mgcv, r-mime, r-nlme, r-plyr, r-promises, r-purrr, r-rcpp, r-readr, r-rlang, r-sp, r-stringi, r-sys, r-tibble, r-tidyr, r-tzdb, r-utf8, r-vctrs, r-vroom, r-xfun, r-yaml" in WASM: https://github.com/emscripten-forge/recipes/tree/main/recipe...

It looks like xeus-r and webr both compile with emscripten; for which there's emscripten-forge which is like conda-forge but for browser WASM.

by tovejon 8/23/2025, 12:19 PM

Does this also support Rmd?

That would be pretty cool if you could publish an rstudio notebook and have a flow to edit a copy of the notebook straight in the web.

by stabbleson 8/23/2025, 11:03 AM

Does it include a decent BLAS? If I remember correctly R ships with reference BLAS, but for decent performance you need something external. Wonder what they picked for wasm based R.

by Qemon 8/23/2025, 1:08 PM

Can you install it as a progressive web app, to work offline as well?

by ForceBruon 8/23/2025, 3:49 PM

Is there "Julia in the browser" that runs locally?

by tlarkworthyon 8/23/2025, 2:42 PM

Cool but 12MB WASM blob. I wish there was a way of making these WASM builds significantly smaller.

by paul_hon 8/24/2025, 8:24 AM

eval_js()- allows R code to execute JavaScript and manipulate DOM elements - neat.

by italodevon 8/23/2025, 6:53 PM

Very useful, thanks