R Jupyter Notebook + RStan on Google Colab

rstan
#1

Hi every one,

I’ve created a simple notebook to support R and Rstan on Google Colab.

You just need to copy this notebook to your Google Drive.

https://colab.research.google.com/drive/1xj_aYLBBPX2oSQ1I4xp5_YZiVhhpC1Ke

I was inspired by

which supports Julia on Google Colab.

Having fun!

3 Likes

#2

It should work from github too?

0 Likes

#3

Yes It works on Github repo and Gist too.

0 Likes

#4

Cool! Thanks for sharing. There’s also the version on RStudio that pulls up an RStudio session on the web rather than Jupyter. @andrewgelman has been looking for these to show new users without having to install Stan.

0 Likes

#5

I couln’t use library() function. I can install packages but I can’t use them. Do you know how to solve this?
I believe using :: notation works. But I am trying to write something like, as(myMatrix, “realRatingMatrix”) and it can’t do this. recommenderlab::as() also not working.

0 Likes

#6

Can you run the R code examples in my notebook successfully?

https://colab.research.google.com/drive/1xj_aYLBBPX2oSQ1I4xp5_YZiVhhpC1Ke

I used library() function in these examples and it seems to work correctly.

0 Likes

#7

Hello Ari, I was unable to run the script on my Drive (sorry, newcomer on Colab).
The error:

–2019-03-03 19:31:33-- https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
Resolving repo.continuum.io (repo.continuum.io)… 104.18.200.79, 104.18.201.79, 2606:4700::6812:c84f, …
Connecting to repo.continuum.io (repo.continuum.io)|104.18.200.79|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 69826864 (67M) [application/x-sh]
Saving to: ‘Miniconda3-latest-Linux-x86_64.sh.4’
Miniconda3-latest-L 100%[===================>] 66.59M 130MB/s in 0.5s
2019-03-03 19:31:33 (130 MB/s) - ‘Miniconda3-latest-Linux-x86_64.sh.4’ saved [69826864/69826864]
mkdir: cannot create directory ‘/root/.R/’: File exists

Have any ideias on how to surpass it?
Thanks for all the work done here!

0 Likes

#8

Hi,

You may first have to reset your runtime by going to menu Runtime -> Reset all runtimes. After that, run Setup code. After 3 mins your runtime will be restarted. Now, go to Runtime -> Manage Session, and terminate your Session. Reconnect and skip the Setup code, run the R code.

1 Like