Running R and Debian Linux in the Browser Via WASM

[This article was first published on Rstats – OUseful.Info, the blog…, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

A few weeks ago, I noted the appearance of georgestagg/webR, an R distribution compiled to WASM that runs completely in the browser. The environment is served from a simple webserver, and requires no installation of R onto a back-end server or onto your own desktop. Instead, the environment runs inside a virtual machine inside your browser (try it here):

WebR – R in the browser

For an iframe embeddable Python REPL running in the browser, see for example jtpio/replite.

replite in-browser JupyterLite powered REPL

At the moment, in WebR, I can’t see a direct way of displaying graphical (chart) output, (there appear to be various blockers with the handling of bitmap images?), although I note that the svglite package is installed and seems to work…

svglite package running in webR

WebR appears to be using https://terminal.jcubic.pl/ for the terminal UI, which in turn appears to support the definition of custom terminal functions; it also looks from jcubic/jquery.terminal#278  that the terminal can output and render images via HTML <img /> tags, so presumably it could also add <svg /> tags to the DOM. Which makes me wonder: could a custom function be defined that will read the contents of the SVG file and display it via an HTML <svg> element?

I also wonder if the rendering machinery of JuptyerLite could be used to support the rendering of graphical output (though some magic may need to be involved?). There are several demos of JupyterLite kernels built using the Xeus Jupyter kernel framework, (which includes an early demo of an R kernel, Juniper Kernel), which makes me think; what would be involved in co-opting the WebR build process for use in a Xeus context to create a Xeus JupyterLite R kernel?

In passing, I also note there is a full Debian installation available running via WASM in the browser: WebVM: server-less x86 virtual machines in the browser (try it here: webvm.io ).

See also: jupyterlite — “serverless” Jupyter In the Browser Using Pyodide and WASM and SQL Databases in the Browser, via WASM: SQLite and DuckDB.

To leave a comment for the author, please follow the link and comment on their blog: Rstats – OUseful.Info, the blog….

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)