How to run R codes in Google Colab?
Google Colab is essentially a Jupyter notebook environment, which means that typically only Python code works. However, it is also possible to use R code in Google Colab. If you’re unfamiliar with Google Colab, please read the post below to grasp its general concept.
□ How to use Google Colab for Python (power tool to analyze data)?
When opening a new Google Colab window, navigate to Runtime
in the menu, choose Change runtime type
, and a new window will appear, allowing you to switch the runtime type from Python3
to R
.
Let’s run some R code to confirm that it works in Google Colab. I’ll be using the same codes I employed earlier in Google Colab. The codes are as follows:
□ Enhancing Visualizations: Manipulating Color and Shape in R with Two Variables
I ran the same code in Google Colab, and it worked well. I’ll upload the code and the graph as a page to my GitHub.
The page has been uploaded to GitHub. This is one of the powerful strengths of Google Colab, allowing us to save our code as a page for easy tracking of our work.
Code summary https://github.com/agronomy4future/r_code/blob/main/Enhancing_Visualizations_Manipulating_Color_and_Shape_in_R_with_Two_Variables.ipynb