Member-only story

How to Expedite R package installation in Google Colab?

DigNo Ape
2 min readApr 18, 2024

--

R is a programming language for statistical computing and data visualization. It has been adopted in the fields of data mining, bioinformatics, and data analysis.

Like Python, R now is available in Google Colab Notebook. You can use it by using command %load_ext rpy2.ipython or change it to R in the Runtime type.

We need to install and import required packages (libraries) but these installed packages will be reset/ removed every time you revisit the notebook. We can reinstall them, but it could take long time for some large packages. So, we would like to show you how to expedite the process by

  1. zipping the installed packages.
  2. saving them in the google drive.
  3. moving back to the lib
  4. unzipping the files

When you first open Colab notebook, you can find there are only few folders. When we try to import library tidyquant and it is showing no package called ‘tidyquant’.

So let’s install the package and zip it and saved it into Google Drive folder src.

%%R
install.packages('tidyquant')

--

--

DigNo Ape
DigNo Ape

Written by DigNo Ape

我們秉持著從原人進化的精神,不斷追求智慧的累積和工具的運用來提升生產力。我們相信,每一個成員都擁有無限的潛力,透過學習和實踐,不斷成長和進步。

Responses (1)