March 12, 2019

· Visualization · R

I’ve gotten a couple of reports from people having trouble installing the development version of the socviz library that’s meant to be used with Data Visualization: A Practical Introduction. As best as I can tell, the difficulties are being caused by GitHub’s rate limits. The symptom is that, after installing the tidyverse and devtools libraries, you try install_github("kjhealy/socviz") and get an error something like this:

Error in utils::download.file(url, path, 
method = download_method(), quiet = quiet():
cannot open URL

If this is the problem you have, this post explains what’s happening and provides a solution. (In fact, several solutions.)


When you download and install a package from GitHub via R or RStudio, you use their “API”, or application programming interface. This is just a term for how a website allows applications to interact with it. APIs standardize various requests that applications can make, for example, or provide a set of services in a form that can be easily integrated into an application’s code. This is needed because apps are not like people clicking buttons on a web page, for example. One of the main things APIs do is impose rules about how much and how often applications can interact with them. Again, this is needed because apps can slurp up information much faster than people clicking links. This is called “rate limiting”. By default, if you do not have a (free) GitHub account, your rate limit will be quite low and you will be temporarily cut off.

The simplest solution

Option Zero The socviz library is now on CRAN. That is, it’s available from the main repository for R packages. This wasn’t the case when the book went to print. So, simply do the following from the R console:


This should work without any problems, assuming you are connected to the internet.

If you want to use GitHub instead of CRAN

If you want the development version on GitHub, instead of the version on CRAN, then you have three options.

Option 1 Wait until tomorrow and try again. The rate limit will reset, and it should work again. But you will likely keep having this sort of problem if you use GitHub regularly. You may also not want to wait.

Option 2 Download and install the package manually, from my website rather than GitHub. Click on this link:

This will download a .tar.gz file to your computer. Open R Studio and choose Tools > Install Packages … In the dialog box that comes up, select “Package Archive File” like this:

Package select

Package selection dialog

Then navigate to the file, choose it, and select “Install”. The socviz package should now be available via library(socviz). The downside to this solution is that you won’t be able to get updates to the package easily later on, and you’ll still run into rate limits with other packages.

Option 3 The third option is a tiny bit more involved, but is the best one if you are planning on using GitHub for anything else to do with R in future. You should create a user account on GitHub, and then obtain a “Personal Access Token” (PAT) from them. This is a magic token that substantially boosts your rate limit for transfers to and from GitHub and will make your problem go away for this and any other package installations you have. Once you’ve opened an account, there are detailed instructions here about how to obtain and activate your PAT token in R Studio:

You will only have to do this once, and the token will work for any and all package installations you do via GitHub.

All Categories


I am Professor of Sociology at Duke University. I’m affiliated with the Kenan Institute for Ethics, the Markets and Management Studies program, and the Duke Network Analysis Center. Learn more.



To be notified of updates, you can subscribe to the  RSS feed for the site.