Search code examples
rgoogle-colaboratory

Load multiple packages in R using Google Colab


The question is specific to Google Colaboratory (and the solution for R in general doesn't work), and has answers referring to Python, but I am inquiring about R packages, which do work flawlessly in Google Colab, allowing a clean document to be generated with Markdown and code.

Incidentally, Google Colab is absolutely fabulous if you are working behind a firewall blocking the download of R packages - so if you wonder why Google Colab, and not RStudio Markdown, this is the one beautiful, magnificent, unsurpassed advantage (in this setting). If you don't understand what I am referring to, you haven't spent time in the corporate world, so don't worry about it (RStudio still the best).

Here is the failed attempt to extrapolate the suggestion on this post for R (or RStudio) to Google Colab:

install.packages('RCurl')
require(repr) 
require(RCurl)
require(foreign)
require(tidyverse)

enter image description here


Solution

  • What about suppressPackageStartupMessages({...})

    install.packages('RCurl')
    suppressPackageStartupMessages({
        require(repr) 
        require(RCurl)
        require(foreign)
        require(tidyverse)
    })