R in Your Pocket

Bringing R to iPhone and iPad with WebAssembly.

r
webassembly
ios
webr
Author

James Balamuta

Published

January 23, 2026

Abstract

webRios is an iOS app that runs R directly on your iPhone or iPad through webR, a WebAssembly port of R. No server, no internet connection required for computation. This post introduces the app, explains how webR makes R-on-mobile possible, and discusses the trade-offs that come with running a full statistical computing environment inside a mobile WebAssembly sandbox.

Today we’re releasing webRios, an app that lets you write and run R code on your iPhone or iPad. It’s available now on the App Store.

The idea is straightforward: a full R console, code editor, plot viewer, and package manager, all running locally on your device. No server to connect to, no cloud account to sign up for. You can write R on the train, explore a dataset on the couch, or prototype a visualization waiting for coffee. Everything happens on-device.

This is possible because of webR, a WebAssembly port of R maintained by George Stagg and others at Posit. webR compiles the R interpreter to WebAssembly so it can run in any environment that supports Wasm, including the embedded browser engine on iOS.

R Wherever You Are

iPhone screenshot showing the webRios R console with syntax-colored output.

Console

iPhone screenshot showing the webRios code editor with syntax highlighting and a custom R keyboard row.

Editor

iPhone screenshot showing the webRios plot gallery displaying R-generated graphics.

Plots

You get a real R console, not a toy. Pipe operators work. ggplot2 renders actual plots. dplyr::mutate() does what you’d expect. The editor has syntax highlighting, a custom keyboard row with <-, |>, and %>%, and you can run your entire script or just a selection.

Install packages from the webR repository with a tap. The tidyverse, data.table, jsonlite, and hundreds of others are available as pre-compiled WebAssembly builds. The app even ships with one-tap bundles so you can go from fresh install to a working tidyverse session in under a minute.

On iPad, it really starts to feel like a proper workspace:

iPad screenshot showing the webRios multi-pane workspace with console and plots side by side.

The iPad multi-pane layout with console, editor, plots, and environment all visible at once.

Why webR?

The obvious question: why not just compile R natively for iOS?

We tried. We got surprisingly far: R 4.5.2 cross-compiles for iOS ARM64, base R runs, and you can render plots through Core Graphics. The wall was dlopen(). iOS prohibits loading dynamic libraries at runtime, which is exactly how R loads packages with compiled code. No tidyverse, no data.table, no Rcpp. The full write-up covers what worked, what didn’t, and why dynamic symbol loading is the real blocker.

webR sidesteps the whole problem. The R interpreter and a large library of CRAN packages are already compiled to WebAssembly and hosted at repo.r-wasm.org, maintained by George Stagg and others at Posit. WebAssembly runs inside a sandboxed virtual machine, which plays nicely with iOS’s security model. No jailbreak, no private APIs, no patching R source. Package installation just works.

In webRios, user code passes through four layers before R sees it (Figure 1):

Architecture diagram showing four boxes connected by arrows: Native UI, JS Bridge, webR, and R interpreter.
Figure 1: Four layers: the native SwiftUI interface, a JavaScript bridge, the webR WebAssembly runtime, and the R interpreter.
Architecture diagram showing four boxes connected by arrows: Native UI, JS Bridge, webR, and R interpreter.
Figure 2: Four layers: the native SwiftUI interface, a JavaScript bridge, the webR WebAssembly runtime, and the R interpreter.
  1. Native UI handles everything the user sees and touches.
  2. JS Bridge translates between Swift and the R runtime.
  3. webR is R compiled to WebAssembly, loaded inside an embedded browser view.
  4. R interpreter executes your code in a sandboxed environment.

The user never sees a browser. The native interface is the only thing on screen. Figure 3 shows what this looks like in practice: you write code in the editor, tap Run, and webR executes it locally. Results fan out to the console, plot gallery, and environment inspector all at once.

Diagram showing the user experience: code written in the editor flows through webR and results fan out to the console showing output, the plot gallery showing a histogram, and the environment inspector showing variable details.
Figure 3: Write code in the editor, tap Run, and webR executes it on your device. Results appear in the console, plots render in the gallery, and new variables show up in the environment inspector.
Diagram showing the user experience: code written in the editor flows through webR and results fan out to the console showing output, the plot gallery showing a histogram, and the environment inspector showing variable details.
Figure 4: Write code in the editor, tap Run, and webR executes it on your device. Results appear in the console, plots render in the gallery, and new variables show up in the environment inspector.

What to Expect

This is R on a phone. It’s genuinely useful, but it’s not a laptop replacement. A few things worth knowing upfront:

Five cards: 300 MB memory, 5-15 second startup, CRAN subset, fully local execution, fresh sessions each launch.
Figure 5: Key characteristics of running R via WebAssembly on iOS.
Five cards: 300 MB memory, 5-15 second startup, CRAN subset, fully local execution, fresh sessions each launch.
Figure 6: Key characteristics of running R via WebAssembly on iOS.
  • ~300 MB of memory. Plenty for interactive work, but you won’t be loading a 2 GB CSV. If things get tight, clear plots or run GC from Settings.
  • 5-15 seconds to start. WebAssembly needs time to initialize. Subsequent launches are faster thanks to caching.
  • Most popular packages, not all. The webR repository has the tidyverse, ggplot2, data.table, and hundreds more. Packages that need system libraries (database drivers, some spatial tools) may be missing.
  • No interrupting running code. If you accidentally kick off an infinite loop, you’ll need to restart the app.
  • Fresh sessions each launch. Your .R files and installed packages persist, but variables and console history don’t. Put library() calls at the top of your scripts and you’re set.
  • Your code stays on your device. Nothing is sent to a server. You can work entirely offline.

For quick exploration, learning R, or prototyping an idea away from your desk, these are reasonable trade-offs.

Compared to Other Options

There are a few other ways to run R on an iPhone:

  • R Programming Compiler sends your code to a remote server and returns results, with a 20-second timeout. It requires an internet connection and your code leaves your device.
  • R Analyst runs R locally using an older embedded engine (R 4.2.1, last updated in early 2023) and doesn’t support installing additional packages.
  • iSH can run Alpine Linux on iOS, and R can be installed through Alpine’s package manager. This gives you native R, but compiling packages on-device is extremely slow (hours for a single package).

webRios sits in a middle ground: local execution (your code never leaves your device), a recent R version tracking webR releases, and the ability to install packages from a large pre-compiled repository.

Android: webRoid

An Android companion app, webRoid, is also in the works. It shares the same webR engine, so R code and packages work across both platforms. webRoid is currently a work in progress and will be available on Google Play.

Try It

webRios is free to download and requires iOS 17 or later.