How to use R in Google Colab?
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Introduction
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.
Data source
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!
content_copy Copy
Leave any questions or concerns you might have in the comments below.
Conclusions
- 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.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.