statscloud

StatsCloud and WebR

WebR brings some exciting new features to StatsCloud

A few years ago, I wrote a blog explaining how statscloud uses R, or, rather, how it doesn't.

To save you a bit of a read, I explained that R is a slightly stubborn piece of software that cannot be installed on all of your modern devices (phones, tablets, laptops with Windows Mode S, and devices with an ARM processor) or, to put it another way, all the devices you'd want it to.

If you wanted to use R on a mobile phone, say, you'd need to install R on a server and send data to that server from your phone. That works fine when you only have a few people using that server at the same time but, when you have 100 students who all want to use it together, that poor little server is going to take a bit of a hammering. And if you have a cloud model that spins up a new server for every new user, so will your wallet.

Realistically then, there's no way a statistics package could make use of R for large numbers of users accessing it on phones or tablets, and certainly not for free. Last year, though, things started to change, thanks to WebR.

WebR is the new kid on the block that allows you to run R in a browser window so you can use it on any device. Thanks to some clever WebAssembly magic, you can now load up an R console in a browser and use it like you would the installed software. This of course is a very exciting development and, naturally, we wanted to take full advantage of it.

Our new R console

This week, we launched the R terminal in statscloud. Now, when you visit the "Code" tab in your statscloud project, you'll see an enticing "Open Terminal" button under your code that will allow you to run your full codebook right there in the app. Data filtering, charts, analyses, the whole shabang.

Here, give it a try:

This integration works particularly well with statscloud because, unlike any other statistics app, statscloud provides you with a full codebook for your whole project. This means that, when you open the terminal, the code for everything you've done in your project so far will already be here; everything from data declaration to running analyses. All you need to do is hit the "Run" button and you'll see R fire into action.

Extensibility

We're not stopping there though. Oh no. As well as making an R Console available to you through the Code tab, we're also planning to use it for some extra analyses that aren't currently available in the app. As outlined in our recent "Big three features for 2024" blog post, we also want to share the magic with you by allowing you to write your own custom modules for statscloud, powered by WebR.

When this is available, you'll be able to write your own custom analyses in the form of a simple R script. Once you have, you can save it to your own personal library or share it with others so you can all benefit from running these on any of your projects in statscloud.

WebR and our business model

Very early on in statscloud's development, I had to decide whether to use R behind the scenes for the statistical computations. Back then, the only way of achieving this was to have R running on a server and then charging you to access it. I didn't think it was fair to charge people to have basic functionality of the app, so I opted to keep the stats computations inside the app so we didn't have to.

As it turns out, this was clearly the right choice to make. If, like others, we had a business model that was based on charging you to access an instance of R on a server which you can now access on your own device for free, we'd be pretty worried right now. Our goal right from the start was to provide a statistics app that would allow you to perform any analysis on any device at any time - for free.

Another good reason for not using R from the beginning is that it's not possible for current R-powered stats packages to just jump over to WebR: There are an awful lot of R libraries in the wild being used, and WebR simply cannot support all of them (although it still supports many of the popular ones). So, if any single dependency that isn't supported is used somewhere in the code, it will break everything.

With statscloud, we have the chance to build R integration from the bottom up, using only the popular tried-and-tested R libraries that are guaranteed to work. This gives us a great opportunity to roll out R features without breaking anything in the meantime.

The future of statscloud with WebR

In case you hadn't noticed, I'm incredibly excited about the future of statscloud with a WebR integration. So far, statscloud has seen the success it has by embracing new technologies, particularly by ensuring it can be installed and run on any device at any time (e.g., as a Progressive Web App). This new integration with WebR takes this exclusivity even further and opens the door for many, many great things for the future.

I can't wait to see what happens next.