Use-case:
Run R in any computer or machine online using Google Colab, without the need to install R or R editors such as R Studio.
Video Tutorial for this blog is available here:
Check out these related tutorial in your convenient time:
- For R related tutorials, see this playlist of video tutorials: https://www.youtube.com/playlist?list=PL_b86y-oyLzCjmxbQceaedPEmuL3GHmpQ
- For Python related tutorials, see this playlist of video tutorials: https://www.youtube.com/playlist?list=PL_b86y-oyLzAQOf0W7MbCXYxEkv27gPN6
Method1: using rpy2 package
Step1: Setting up R in python environment of google colab
%load_ext rpy2.ipython
Step2: installing and loading R packages in google colab
Use “%%R“ in beginning of all the blocks you want to use R code in it
- related tutorial on use of pacman package in more explanation: https://www.youtube.com/watch?v=xHTf3FiJn64
%%R
# Install pacman ("package manager") if needed
if (!require("pacman")) install.packages("pacman")
# Load contributed packages with pacman
pacman::p_load(tidyverse,plotly)
Step3: test the use of R
Method 2:
Add language parameter as below to the end of url of the google colab code:
Use https://colab.research.google.com/#create=true&language=r, or this short URL https://colab.to/r
Related Links
- code solution script: https://colab.research.google.com/drive/1dhArTuFtNim-9jg9-qXuZXHnJQ2yNz-k?usp=sharing