Painless installation of R packages from source

Author
Published

April 16, 2015

I was minding my own business trying to add labels to a line plot in ggplot2. Then I saw that the package directlabels would solve all my problems with one single line of code. I proceed to install it using install.packages("directlabels", repo="http://r-forge.r-project.org"). Sadly:

package directlabels is not available (for R version 3.1.3)

Usually, I would download the source code, then use install.packages() from source. But this still did not work due some dependency issues. Thankfully there is the package devtools to help:

library(devtools)
install_url("http://cran.r-project.org/src/contrib/directlabels_2013.6.15.tar.gz")
library(directlabels)

As simple as that. It also allows installation from github repos.

Reuse

Citation

BibTeX citation:
@online{domingues2015,
  author = {Domingues, António},
  title = {Painless Installation of {R} Packages from Source},
  date = {2015-04-16},
  url = {https://amjdomingues.com/posts/2015-04-19-install-r-packages-from-source/},
  langid = {en}
}
For attribution, please cite this work as:
Domingues, António. 2015. “Painless Installation of R Packages from Source.” April 16, 2015. https://amjdomingues.com/posts/2015-04-19-install-r-packages-from-source/.