Problems with ggplot2 0.8.9 and R 2.13.0 on Mac OS X via plyr 1.5

April 14, 2011

(This article was first published on John Myles White » Statistics, and kindly contributed to R-bloggers)

This morning I tried to completely update my R installation. I first dumped a list of all the packages I have on my system using the installed.packages() function. Then I installed R 2.13.0 using the OS X disk image. And finally I reinstalled all of my packages from scratch.

Unfortunately, I ran into some serious problems along the way. After installing everything from scratch, ‘ggplot2′ 0.8.9 was broken. Specifically, I couldn’t get error bars to work with stat_summary(). For example, this code wouldn’t work on my system:

# Problem with ggplot2 Version "0.8.9"
set.seed(1) <- data.frame(Measurement = rnorm(5, 0, 1), Class = rep('A', 5))
ggplot(, aes(x = Class, y = Measurement)) +
  stat_summary( = 'mean_cl_boot', geom = 'bar') +
  stat_summary( = 'mean_cl_boot', geom = 'errorbar')

Thankfully, I managed to enlist Dirk Eddelbuettel’s help through Twitter and he ran the code on his own recently updated system. Things worked fine for him, which suggested that the problem was in my system configuration. We compared package versions and discovered that he had ‘plyr’ 1.5.1 on his Ubuntu machine, while I had ‘plyr’ 1.5 on my OS X machine. After looking at CRAN, it was clear that the Mac OS X build wasn’t available on CRAN yet.

To fix this, I grabbed the source for ‘plyr’ 1.5.1 and tried to install it myself. That led to the following error:

** preparing package for lazy loading
Error: package 'plyr' is required by 'reshape' so will not be detached

The problem was that ‘reshape’ was being loaded automatically when R was starting up. Since ‘reshape’ depends on ‘plyr’, R wasn’t willing to overwrite my old ‘plyr’ 1.5 with the new ‘plyr’ 1.5.1. The solution was to edit my .Rprofile file to prevent ‘reshape’ from being autoloaded. Once I did this, I was able to run the standard R CMD INSTALL and get the new version of ‘plyr’ on my system. And after that ‘ggplot2′ 0.8.9 started working properly.

Hopefully no one else will come up against the same issue after the binary for ‘plyr’ 1.5.1 gets pushed through all of the CRAN mirrors. But if you get errors while using ‘ggplot2′ 0.8.9, look into installing ‘plyr’ 1.5.1 from source on your system.

Many thanks to Dirk for giving me so much help today.

To leave a comment for the author, please follow the link and comment on their blog: John Myles White » Statistics. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags: , ,

Comments are closed.


Mango solutions

RStudio homepage

Zero Inflated Models and Generalized Linear Mixed Models with R

Quantide: statistical consulting and training


CRC R books series

Contact us if you wish to help support R-bloggers, and place your banner here.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)