mwenge / webR

This project aims to compile the statistical language R into WASM for use in a browser, via Emscripten.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WebR - R in the Browser

This project aims to compile the statistical language R (https://www.r-project.org/) into WASM for use with a browser, via Emscripten (https://emscripten.org/).

Included in the repo is a Dockerfile which is used to setup an environment and toolchain for compiling R's source code and supporting libraries, written in both C and Fortran. The toolchain makes use of specific versions of Emscripten, LLVM, gfortran and Dragonegg. Further information about how the toolchain is setup can be found in the blog post Fortran in the Browser.

The repo includes patches for R-4.1.2's source code so that it can work in the browser environment provided by Emscripten. The patches also tweak R's interactive mode so as to provide a web-based REPL through the use of jQuery Terminal and jcubic's Emscripten POC.

Instructions

Clone the repo into a new directory, cd into the directory, then run make.

A build directory is created which when finished contains the R WASM files and an index.html file ready to serve an R REPL.

Demo

A demo of the resulting R REPL can be found at https://www.mas.ncl.ac.uk/~ngs54/webR/

Loading the page will initally result in a black screen. Please be patient as the WASM runtime downloads and executes. R will display a banner message when it is ready to use.

About

This project aims to compile the statistical language R into WASM for use in a browser, via Emscripten.


Languages

Language:Shell 75.1%Language:HTML 14.8%Language:JavaScript 8.0%Language:Dockerfile 1.7%Language:Makefile 0.3%