Install R packages from Github through proxy

The easiest way to install an R package is from R-Cran. However, as the number of R users is growing up very fast, many developers are contribute to R community through Github. And the standard way to install from Github is to use devtools package with install_github() command.

In many organization, especially financial organization like banking industry, sometimes it is very hard to install an R package from CRAN or Github due to security process. So, in this post I will share with you 2 ways to install an R package via proxy

##Method 1: Using downloader package

In this method, the only thing that you need to change is the Github repository of the R package needed to be installed.

For example, if you want to install package easyRFM from Github with the following link:, you can easily install with the following codes:

#Step 1: Install downloader from CRAN

#Step 2: Download R package from Github in format .tar.gz

#Step 3: Install from source
install.packages("easyRFM.tar.gz", repos = NULL, type = "source")

##Method 2: Using httr package to modify your proxy

In this method, you can modify your proxy using httr package. To modify your proxy, the key function is set_config.


For instance, if your proxy is & your port is 8080, you can modify your proxy as follows:

#Step 1: Call httr & devtools

#Step 2: Modify proxy

#Step 3: Install package directly from Github

#Step 4: Reset your proxy if needed

Two methods above help me a lot to install R packages, specially from Github. Hope that it will help you also to make your life easier!

Anh Hoang Duc
Anh Hoang Duc
Business Analytics professional


comments powered by Disqus