Use R in the cloud

A quick guide about how to how to run R via a cloud computing (serverless) option.

Installation guides quickly become outdated. This page last updated 10 October 2023 and describes working installation protocols at that time.

Run R on your computer (i.e., local development environment or LDE)

This guide is about running R in the cloud, serverless options. For installing R and R Commander onto your own computer, see Install R and Install R Commander.

Run R “in the Cloud”

If you do not wish to install R, or, if you have a Chromebook and, therefore cannot gracefully install R, then there are alternatives; Run R in the Cloud. I’ll list five ways to run R in the cloud — run R on a server, not your own computer — for free.

Note: None of these options can run R Commander, which requires a local (on your computer) installation of R.

If you have a Chromebook, or you want to run R on your tablet (iPad, Kindle, etc.), you can’t install R to any of these devices. However, you can access R via a serverless Cloud solution.

1. Run R code at Online R Compiler using myCompiler’s online IDE, link at https://www.mycompiler.io/online-r-compiler.

Screenshot myCompiler

Figure 5. Screenshot of myCompiler session.

2. Run code snippets in CoCalc by folks at SageMath and available at https://cocalc.com/ . CoCalc uses Jupyter Notebooks, a wonderful, open-source project which supports interactive computer coding for many languages, including R and Markdown.

Create a free account (you’ll then be able to save your code), or simply click “Run CoCalc Now” and check the box to agree to the terms to begin a session (Fig. 6). Choose to open a new Jupyter notebook, then select R (system wide) from the choice of kernels.

Screenshot CoCalc

Figure 6. Screenshot of Google Colab session.

You can load files from your computer for use in CoCalc sessions. There is also a version of the software you can download to your computer.

3. Another good alternative, run R code snippets at Google Colaboratory (Fig. 7). Like CoCalc, Colaboratory uses Jupyter Notebooks. Log into your Google account, then click https://colab.research.google.com/notebook#create=true&language=r , or try the tinyURL https://colab.to/r

Screenshot or R session on Google Colab

Figure 7. Screenshot of Google Colab session.

Colabs is worth the effort — you end up with a system to run R in your browser, it’s free to use, and you can store/retrieve files from your Google Drive. This is my choice for Cloud computing, and it’s the most generic solution. For more information, see post by Ed Adityawarman, How to use R in Google Colab . Colab Jupyter notebooks use Python by default. To run R, either use the link listed above each time you want to create a new R notebook, or add the following code snippet to your new notebook page

# activate R magic - must begin each R code with %%R
%load_ext rpy2.ipython
For all subsequent R code, start the section with
%%R

Note: You can install Jupyter onto your computer via Minicondaconda is an open source package management system but then, you still would have to install R to your computer.

One real advantage of choosing CoLab, there are apps to run Google Colaboratory and Jupyter Notebooks on iPad/iPhone and for Android phones are available at Apple App Store and Google Play, respectively.

4. You can run R at https://rstudio.cloud/. Registration and use is free for students. This works OK, but can be slow and it’s hard to work on your own data. It does have the advantage of providing the familiar RStudio interface. Choose the free plan; Instructions to get started are at https://rstudio.cloud/plans/free. A screenshot of an RStudio cloud session is shown in Figure 8.

screenshot RStudio Cloud session

Figure 8. Screenshot of RStudio Cloud session.

5. For limited use, i.e., you just need to run a little code to solve an assignment problem, you can run R code snippets in your browser at https://rdrr.io/snippets/ . You’ll see many of my code embedded in this service so that you can run code snippets from my Chaminade University CANVAS pages.

screenshot R session at rdrr.io snippets

Figure 9. Screenshot of rdrr.io/snippets session.