Installing R Packages from GitHub
Often interesting new R packages are only available on GitHub. This post shows how to install an R package from GitHub, in each of R, R Studio, and Displayr.
As an example, this post illustrates how to install the flipPlots package to create Sankey diagrams (click here for some example code).
Installing GitHub packages into R
Step 1: Install the devtools package
To install a R package, start by installing the devtools package. The best way to do this is from CRAN, by typing:
Step 2: Install the package of interest from GitHub
Install the package of interest from GitHub using the following code, where you need to remember to list both the author and the name of the package (in GitHub jargon, the package is the repo, which is short for repository). In this example, we are installing the flipPlots package created by Displayr.
Step 3: Load the package
Installing GitHub packages into RStudio
Although RStudio does have various tools for installing packages, the most straightforward approach is to follow the steps described in the previous section, entering the code into the Console in RStudio.
Installing GitHub packages into Displayr
Many GitHub packages, such as flipPlots, are already installed in Displayr, so we’ve done the work for you! If you need any additional packages installed, please reach out to email@example.com.
Ready to install your GitHub package of choice with Displayr?
About Tim Bock
Tim Bock is the founder of Displayr. Tim is a data scientist, who has consulted, published academic papers, and won awards, for problems/techniques as diverse as neural networks, mixture models, data fusion, market segmentation, IPO pricing, small sample research, and data visualization. He has conducted data science projects for numerous companies, including Pfizer, Coca Cola, ACNielsen, KFC, Weight Watchers, Unilever, and Nestle. He is also the founder of Q www.qresearchsoftware.com, a data science product designed for survey research, which is used by all the world’s seven largest market research consultancies. He studied econometrics, maths, and marketing, and has a University Medal and PhD from the University of New South Wales (Australia’s leading research university), where he was an adjunct member of staff for 15 years.