> For the complete documentation index, see [llms.txt](https://www.rforseo.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.rforseo.com/ressources/execute-r-code-online.md).

# Execute R code online

### Use RPubs to publish R code

If the data is public and you want to show off your R skills you can use rpubs directly

You'll need to install the [knitr](https://github.com/yihui/knitr#readme) package (v0.5 or later), there is a mini-tutorial just after registration

[Create an account ](https://rpubs.com/)

### Use RStudio Cloud to publish private code.

There is a 'Cloud' version of RStudio, perfect for a quick demo. For more serious work, there is some [dedicated plans](https://rstudio.cloud/plans/free).

![](/files/-MYVh9ImPh-XdZefuu0l)

Create an account here <https://rstudio.cloud/>

### Use GoogleColab for collaborative work

This is a little-known option but it's possible to use R inside GoogleColab

Start [*rmagic*](https://rpy2.github.io/doc/latest/html/interactive.html) by executing this in a cell:

```
%load_ext rpy2.ipython
```

Then start your script by `%%R` to execute

```r
%%R

x <- 1:10

x
# it should display number from 1 to 10
```

[more details about this feature](https://towardsdatascience.com/how-to-use-r-in-google-colab-b6e02d736497)

#### Native R on GoogleColab

you can switch runtime from Python to R in the options and execute native code directly

( *tested in may 2024* )

<figure><img src="/files/fu2qjjf77tBrC3xxvWBx" alt=""><figcaption></figcaption></figure>

#### Execute R code on GitHub

[See this article](/ressources/launch-an-r-script-using-github-actions.md)
