RPad — R on the iPad, with no server and no network

Portfolio

PA
∇⋅E = ρ/ε₀
E = mc²
S = k log W
F = ma
All posts

Shipping

Seventy-five R packages compiled for iOS and checked against reference R output: from classical tests all the way to Stan.

Platform
iPad
Inside
75 packages, including tidyverse, ggplot2, Stan and brms
Built with
R, Rcpp, cross-compilation to iOS

The problem

The existing ways of doing statistics on a tablet send the computation elsewhere: a remote server runs the code and returns a picture. That assumes a network, an account, and the confidence that the patient's, the client's or the experiment's data will happily make the round trip.

What I built

R itself, on the iPad. You write a script, you run it, you see the plots — offline, on the device. Seventy-five packages are compiled and shipped with the application: the tidyverse and ggplot2 to wrangle and draw, mixed models, and up to Stan and brms for Bayesian inference. Nothing leaves the iPad.

What was hard

R was not designed for iOS, and iOS forbids exactly what R takes for granted: compiling code on the fly and loading it. The toolchain had to be moved upstream, the packages produced ahead of time for the phone's architecture, and Stan — a compiler disguised as a library — had to be made to fit those rules. Then every package had to be checked to confirm its output really is reference R's: in statistics, a plausible but different answer is the worst possible answer.

Where it stands

Shipping on the App Store for iPad. It is the same foundation behind the Bayesian analyses and cluster studies presented on this site.