Introducing Rlinguo, a native mobile app that runs R
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
You can read the original post in its original format on Rtask website by ThinkR here: Introducing Rlinguo, a native mobile app that runs R
Rlinguo
is a groundbreaking mobile application that uses R in the backend to handle its business logic.
Available for download now:
Yes, you read that right: the future is now, and we can run R on your mobile phone.
Once upon a time…
I’ve been building web apps with R for quite some time now—probably longer than I’d like to admit. At ThinkR, we’ve been developing {shiny}
apps for a while, ranging from small widgets for researchers to large-scale dashboards used by thousands of bankers.
But web development hasn’t been limited to {shiny}
for us. We’ve also created REST APIs, flex/quarto dashboards, and dynamic documents generated with R. Over the past few years, we’ve explored various ways to deliver data products to our clients, primarily using {shiny}
apps but also through other formats.
Amid this diversity of formats, one platform has consistently evaded us: mobile. Yes, {shiny}
apps can be optimized for mobile use, and JavaScript dashboards can display nicely on a phone. However, they’re not native mobile apps. They can’t be installed from an app store, don’t have access to your phone’s APIs, and making them work offline is a significant challenge.
{shiny}
on my mobile
“{shiny}
on my mobile” has been a recurring request from our clients for some time now. And it’s easy to see why: you might have a fantastic model or efficient data wrangling process, and you need people to access it on their smartphones—even in the middle of the forest with no cell connection (yes, that was an actual request from one of our clients). Yet, our response has always been the same: “Sorry, that’s not possible.” {shiny}
relies on a server, and since R can’t run directly on a phone, a remote server is required. That means an internet connection is necessary. And no, you can’t publish it to an app store.
In recent months, however, something new has emerged—a development that R enthusiasts have been dreaming of for years: R, compiled for WebAssembly. If you’re unfamiliar with WebAssembly, think of it as a way to run R inside JavaScript. If you’re already acquainted with it, you’ll know it’s a bit more nuanced than that, but I’ll spare the technical details for now.
This new tool is called webR
.
The “What If” Moment
I’ve been experimenting with webR
for several months now, primarily from a Node.js perspective. During this time, I developed two tools, webrcli
and spidyr
, specifically designed for projects that integrate R and Node.js. While these tools have the potential to revolutionize app development, they are still tied to a remote web-based approach: R runs on a server elsewhere, inside a Node.js process. This means there’s still no offline functionality, no app store deployment, and no native mobile features.
This summer, we received yet another request for “{shiny}
as a native mobile app.” As we were about to deliver our usual response, I had a “What if?” moment. What if we could use webR
in a JavaScript framework that creates mobile apps? With this idea, we developed a proof of concept (PoC): a mobile app capable of running one line of R code. A fully functional app of this nature had never been done before, but we believed it was achievable.
Unfortunately, the client chose not to pursue the project. Building a mobile app requires skills beyond those typical of {shiny}
developers, and they needed software they could maintain independently. Nevertheless, having created a PoC, we decided to go all in and develop a complete application—something user-friendly, slightly playful, and distributable via app stores, to prove that this could indeed be done.
Over the next few weeks, the team at ThinkR brought this vision to life. Margot shaped the project and wrote the concept paper (more on that in a future blog post), Arthur crafted the app mock-up using Excalidraw and Figma, showcasing his exceptional UI skills, and I (Colin) focused on backend development (largely because my design skills are… lacking, and frontend work is not my forte).
The result of this exciting journey is Rlinguo, a native mobile app that runs R. Yes, you read that correctly—R can now run on your phone, and this app is a proof of concept turned reality.
The Shape of R to Come
Rlinguo is a playful and quirky game that challenges users to identify which package a given R function belongs to. Admittedly, this may not be the most practical skill—knowing that mean()
is in {base}
while median()
resides in {stats}
won’t necessarily make you a better developer (although, I must admit, it still irks me that they’re in separate packages).
The primary goal of this app was to serve as proof that native mobile apps leveraging the power of R are not only possible but can also pave the way for broader applications.
The app demonstrates several groundbreaking capabilities:
- R at your fingertips, straight from your pocket:
The app showcases R’s functionality in multiple ways, such as performing asample()
from a list of installed packages and another from exported functions. On the About page, users can even execute arunif()
to confirm that Rlinguo truly runs R behind the scenes. - Offline Functionality:
Designed to work without an internet connection, Rlinguo makes it possible to deploy R models on smartphones—even for users in remote, disconnected locations, such as deep in the woods - Enabling a Real Data-Science Workflow:
Rlinguo mirrors a typical data-science pipeline. Data is stored locally in an SQL database, queried, processed in R (via counting and pivoting), and then returned to JavaScript for visualization. The result? A user-friendly display of your game performance. - Integrating R Packages:
The app uses R packages creatively. When you guess a function correctly, you’re rewarded with apraise::praise()
message; if you’re wrong, a custom function provides feedback (though I’ve yet to find a package dedicated to offering words of encouragement). - Delivering a Great User Experience:
Rlinguo prioritizes usability, addressing a common shortfall in tools incorporating R. The goal was to craft an app that feels polished and enjoyable to use. - Deploying R-Based Apps to Stores:
Rlinguo demonstrates that it’s entirely feasible to create a mobile app powered by R and make it available for download on major app stores..
Rlinguo is available now on the Apple Store and Google Play. We see this as the first step in a new wave of innovation, and to borrow a phrase, “baby, you never felt this good.”
You’ve got a use case?
The idea of running R on a phone has been a popular request from our clients — there are countless possibilities.
Is this something you need? Do you have a fantastic use case for R on your phone? Perfect, let’s chat!
Notes:
(*) We identified two applications on the App Store that incorporate webR
. However, these appear to function primarily as wrappers around JavaScript integrated development environments (IDEs) and do not address our specific objective: creating a “real-life” mobile application that utilizes R for its core business logic.
This post is better presented on its original ThinkR website here: Introducing Rlinguo, a native mobile app that runs R
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.