The joy of R. The portability of Rust.
Explore data, make beautiful plots, and give local AI a statistical tool— in a browser, a desktop application, or a mobile app.
Run the website · Embed R · Compatibility · Contribute
80 observations. One good hunch. Real R code, running on a Rust runtime.
Rove is the showcase and embedding experience for R-rust, an experimental Rust port of GNU R. It implements the interpreter and numerical routines in Rust, rather than wrapping an installed R process. The default linear algebra backend uses faer; portable graphics use Vello.
The ambition is a faithful, pleasant R runtime you can bring into your own software. It is already useful for the supported examples and embedding contracts. It is not yet a drop-in replacement for GNU R.
set.seed(42)
x <- seq(0, 10, length.out = 80)
y <- sin(x) + rnorm(80, sd = 0.22)
fit <- loess(y ~ x, span = 0.3)
plot(x, y, pch = 16, col = "#a8b6ae",
xlab = "Time", ylab = "Signal", main = "A little less noise")
lines(x, predict(fit), col = "#cc5636", lwd = 3)The website has 18 editable examples: statistics, simulations, correlation matrices, probability formulas, and everyday data work. Run them automatically as you edit, or switch to manual execution. Open the standalone editor when you want a quieter workspace.
![]() Watch averages settle. See the central limit theorem emerge from simulation. |
![]() Find your rhythm. Build a calendar from small moments. |
| Where | What you can build | Start here |
|---|---|---|
| Browser | A WebAssembly editor, local analysis and PNG plots, running in a worker | Website setup |
| Rust | An embedded interpreter with owned values and session-scoped handles | r-embed |
| Mobile | Kotlin and Swift integrations through UniFFI bindings | r-uniffi |
| Local AI | A model drafts R; the runtime computes and plots the answer | Runnable AI demo |
| Graphics | Portable CPU rendering and optional GPU canvas/window presentation APIs | Vello GPU |
| Numerics | Distribution and special-function routines without the interpreter | Standalone nmath |
The AI demo supports a WebGPU browser model and an optional Ollama endpoint. You review the generated code before opening it in the playground. Model weights download only when requested; they are separate from the R runtime.
For the website, install the prerequisites listed in the setup guide, then:
git clone https://github.com/bernaferrari/R-rust.git
cd R-rust/website
pnpm install --frozen-lockfile
pnpm build:runtime
pnpm devOpen the printed local URL. /editor/ opens just the editor; /examples/ opens the gallery.
For a native interactive R session, from the repository root:
cargo run -p r-host-cliRust is pinned in rust-toolchain.toml; dependencies are locked. The default numerical backend is pure Rust/faer. A desktop-only Fortran BLAS/LAPACK profile is also available through the mutually exclusive fortran-backend feature; see backend features.
The implemented surface includes the parser and evaluator, functions and dispatch, vectors and data frames, supported base/statistics operations, seeded random numbers, LOESS, and portable plots. Grid and plotmath share the portable rendering engine.
The important limits are concrete:
- Packages: arbitrary CRAN packages, native extensions and serialized package data are not generally supported in the browser.
- Language fidelity: compiler/bytecode behavior, namespaces, locales and parts of the GNU R API remain incomplete.
- Graphics: advanced grid semantics and exact GNU R font typography still need work. The website uses Vello CPU; GPU presentation is a separate integration surface.
- Safety: owned host APIs keep raw interpreter objects private, but unsafe internals still need wider auditing. The runtime is experimental and is not a security boundary for untrusted programs.
- Resource limits: the browser has a worker timeout and a combined 1 MiB console capture limit. The browser also enforces a 64 MiB R arena budget, bounded result export, and a 256 MiB Wasm linear-memory ceiling. Browser overhead and AI model weights are separate; native hosts must configure their own limits.
See the compatibility evidence and graphics contracts for the exact scope. Android, browser and desktop support each have different host constraints; bindings alone do not establish a finished mobile integration.
At the latest verified checkpoint, 636 curated GNU R comparison cases and 2,852 workspace tests passed (5 tests were ignored). Browser tests also exercise actual Wasm execution, memory limits, theme accessibility, and auto/manual behavior. These are bounded checks, not an implementation percentage or a claim that every R program works.
The compatibility oracle is pinned to GNU R source commit bac583951b. Tests compare against that exact revision; the test contract explains provenance, upstream tests, Miri and GC stress coverage.
scripts/cargo_dev.sh test --workspace
scripts/cargo_dev.sh clippy --workspace --all-targets -- -D warnings
# Install the exact GNU R oracle, then use its printed bin directory:
./scripts/install_r_oracle.sh
PATH="/path/to/R/bin:$PATH" ./scripts/conformance_parity.sh --strictThe local Cargo wrapper runs Cargo with unchanged compilation settings, then
keeps the two newest executable variants per target name. It also clears cached
compiler-warning logs larger than 10 MiB after seven days. Libraries, object
files and incremental caches are retained; an older executable may need relinking
if its configuration is used again. The release gate uses this wrapper too.
Direct cargo commands remain available and do not trigger cleanup. Preview
manual cleanup with python3 scripts/prune_build_binaries.py before adding
--apply. Use CARGO_TARGET_DIR or --target-dir for an isolated cache.
The most useful contributions close a real contract: a small R program, its GNU R result, and a focused implementation or regression test. Good next areas include package loading, grid units and viewport trees, typography, memory budgets, and embedding-boundary fuzzing.
| Inside the repository | Purpose |
|---|---|
crates/rmath |
Parser, evaluator, object model, GC and translated library operations |
crates/r-embed |
Owned host API and session handles |
crates/r-wasm |
Browser runtime boundary |
crates/r-graphics-engine |
Portable graphics and mathematical layout |
website |
React showcase, editor, examples and local AI |
apps/workbench |
Full Android and Kotlin/Wasm workbench |
examples/android-compose |
Minimal Android embedding example: sessions, plots and cancellation |
tests |
Differential, conformance and upstream test evidence |
docs |
Maintained contracts, verification and release guides |
Root configuration files are used by Cargo, formatting, CI and agent tooling.
.cargo must stay here for Cargo discovery. LICENSE, COPYING and NOTICE.md
preserve license discovery and upstream attribution. Generated artifacts belong
under target/; r-source/ is an ignored local upstream reference checkout.
Read the architecture, upstream port map, and contribution instructions before changing runtime invariants. Work is tracked with bd.
GPL-2.0-or-later, matching upstream R. See LICENSE, COPYING, and license provenance.
This project builds on the work of the R Core Team, the R Foundation, and R's contributors. The GNU R source reference is reproducible from a pinned revision; it is used to guide and verify the port. Rust changes do not erase that provenance.

