How to use R in Google Colab?
What you will learn
- Get a foundational understanding of Google Colab's concept and capabilities;
- Learn a step-by-step on setting up R within Google Colab;
- Follow a hands-on example of online coding using the 'babynames' R package,
Table of Contents
- Data source
- Coding the past: How to use R in Google Colab?
Greetings, humanists, social and data scientists!
Ever imagined a world where any computer with an internet browser could be your playground for programming in R? Believe it, because this is your reality! Google Colab enables you to execute R code with remarkable ease, eliminating the need for installations and providing a seamless setup process. The cherry on top? It’s free and allows easy sharing and collaboration on your projects.
In this lesson, I will show you how to use R in Google Colab and suggest a code example to explore the popularity of baby names over the last century. Don’t forget to check out the step-by-step tutorial in the video below! Additionally, feel free to copy the example code from the sections that follow.
The data used in this tutorial comes from the
babynames package. It contains a dataset with baby names registered between 1880 and 2017 in the United States. For further details, please explore the documentation of the package here.
Coding the past: How to use R in Google Colab?
1. Set the right runtime
It is actually quite straightforward to configure Google Colab to accept R code. All you have to do is change the runtime type from
Python 3 to
R. Check the figure below.
2. Example: using R in Google Colab
Below you find the code used in the video tutorial. Feel free to copy, test and change it!
Leave any questions or concerns you might have in the comments below.
- Google Colab provides a hassle-free journey into the world of R programming and data exploration;
- with a small change in Google Colab runtime type, it can proccess R code
- mastering the use of R within Google Colab not only enriches our data analysis skills but also paves the way for enhanced collaborative computing in the cloud.