Installing ggraph on Centos 7 when udunits2 is misbehaving

This is a bit specific and (hopefully) quite straight forward when you know how but I have spent the morning trying to figure it all out so perhaps this post will be helpful to someone.

The first step for me was to install udunits2 so head to your terminal and enter the following (you will need to enter your password when prompted):

sudo yum install udunits2-devel

All going well you can check that everything has installed in standard directories with a quick:

rpm -ql udunits2-devel

Hopefully your output will look something like this:


Next head back to your R or Rstudio console and enter:

install.packages('udunits2', type = 'source', repo = '', configure.args='--with-udunits2-include=/usr/include/udunits2')

Note the configure.args=’–with-udunits2-include=/usr/include/udunits2′ argument was the magic sauce for me as R couldn’t find my installation of udunits without it. Presumably you can modify this if your version of udunits2 is installed elsewhere.

And with that I was able to run:


which happily installed ggraph and all of its dependencies.

Hope that’s helpful if you have read this far!