We’re pleased to announce new versions of ggplot2 (0.9.3) and plyr (1.8). To get up and running with the new versions, start a clean R session without ggplot2 or plyr loaded, and run install.packages(c("ggplot2", "gtable", "scales", "plyr")). Read on to find out what’s new.
ggplot2 0.9.3
Most of the changes version 0.9.3 are bug fixes. Perhaps the most visible change is that ggplot will now print out warning messages when you use stat="bin" and also map a variable to y. For example, these are valid:
ggplot(mtcars, aes(wt, mpg)) + geom_bar(stat = "identity")
ggplot(mtcars, aes(cyl)) + geom_bar(stat = "bin")
But this will result in some warnings:
ggplot(mtcars, aes(wt, mpg)) + geom_bar(stat = "bin")
# The default stat for geom_bar is "bin", so this is the same as above:
ggplot(mtcars, aes(wt, mpg)) + geom_bar()
The reason for this change is to make behavior more consistent – stat_bin generates a y value, and so should not work when you also map a value to y.
For a full list of changes, please see the NEWS file.
plyr 1.8
Version 1.8 has 28 improvements and bug fixes. Among the most prominent:
- All parallel plyr functions gain a
.paroptsargument, a list of options that is passed ontoforeachwhich allows you to control parallel execution. progress_timeis a new progress bar contributed by Mike Lawrence estimates the amount of time remaining before a job is complete- The summarise() function now calculates columns sequentially, so you can calculate new columns from other new columns, like this:
summarise(mtcars, x = disp/10, y = x/10)This behavior is similar to the mutate() function. Please be aware that this could change the behavior of existing code, if any columns of the output have the same name but different values as columns in the input. For example, this will result in different behavior in plyr 1.7 and 1.8:
summarise(mtcars, disp = disp/10, y = disp*10)In the old version, the y column would equal
mtcars$disp * 10, and in the new version, it would equalmtcars$disp. - There are a number of performance improvements:
a*plyuses more efficient indexing so should be more competitive withapply;d*ply,quickdf_dfandidata.frameall have performance tweaks which will help a few people out a lot, and a lot of people a little.
For a full list of changes, please see the NEWS file.



16 comments
Comments feed for this article
December 6, 2012 at 5:00 pm
JNFoo
As always, love these packages and love the fact they are always being improved upon!
December 6, 2012 at 10:06 pm
gcicc
I followed the install options. Code I was using yields graphics that look fine, but I’m encountering a series of errors:
# The following `from` values were not present in `x`: col, color, pch, cex, lty, lwd, srt, adj, bg, fg, min, max
Any ideas?
December 6, 2012 at 10:20 pm
winstonchang
This is an error we’ve seen when the new version of plyr (1.8) is used with the old version of ggplot2 (0.9.2.1). To make sure the upgrade goes smoothly, you should start a new R session (without ggplot2 or plyr loaded), and then install the new versions of both. It’s also possible that your CRAN mirror is slightly behind, and does not have the latest version of both packages. After installing and loading the packages, run `sessionInfo()` to check which versions you have.
One more thing: if you previously installed the release candidate versions of these packages, you need to force R to update to the final released versions by running `install.packages(c(“ggplot2″, “plyr”), dep = T)`.
December 7, 2012 at 7:30 am
Anja
I’m also getting these messages although ‘sessionInfo()’ shows ‘ggplot2_0.9.3′ and ‘plyr_1.8′. Any ideas what else I could try?
December 7, 2012 at 8:06 am
gcicc
Unfortunately, I still run into problems:
sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: i386-w64-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] splines grid stats graphics grDevices utils datasets
[8] methods base
other attached packages:
[1] lubridate_1.2.0 doBy_4.5-3 MASS_7.3-22 snow_0.3-10
[5] lme4_0.999999-0 Matrix_1.0-9 lattice_0.20-10 multcomp_1.2-14
[9] mvtnorm_0.9-9993 R2HTML_2.2 plotrix_3.4-5 gdata_2.12.0
[13] reshape_0.8.4 plyr_1.8 survival_2.36-14 chron_2.3-42
[17] fields_6.7 spam_0.29-2 gridExtra_0.9.1 ggplot2_0.9.3
[21] scales_0.2.3
loaded via a namespace (and not attached):
[1] colorspace_1.2-0 dichromat_1.2-4 digest_0.5.2 gtable_0.1.1
[5] gtools_2.7.0 labeling_0.1 munsell_0.4 nlme_3.1-105
[9] proto_0.3-9.2 RColorBrewer_1.0-5 reshape2_1.2.1 stats4_2.15.2
[13] stringr_0.6.1 tools_2.15.2
> ggplot(mtcars, aes(cyl)) + geom_bar(stat = “bin”)
The following `from` values were not present in `x`: col, color, pch, cex, lty, lwd, srt, adj, bg, fg, min, max
The following `from` values were not present in `x`: col, color, pch, cex, lty, lwd, srt, adj, bg, fg, min, max
The following `from` values were not present in `x`: col, color, pch, cex, lty, lwd, srt, adj, bg, fg, min, max
The following `from` values were not present in `x`: col, color, pch, cex, lty, lwd, srt, adj, bg, fg, min, max
stat_bin: binwidth defaulted to range/30. Use ‘binwidth = x’ to adjust this.
The following `from` values were not present in `x`: col, color, pch, cex, lty, lwd, srt, adj, bg, fg, min, max
The following `from` values were not present in `x`: col, color, pch, cex, lty, lwd, srt, adj, bg, fg, min, max
December 7, 2012 at 9:47 am
winstonchang
Judging by the list of attached packages in your sessionInfo, I suspect that you are automatically loading plyr on startup, in addition to lubridate, doBy, MASS, snow, etc. Make sure that when you start R and run sessionInfo(), there are no attached packages (other than the base packages). Then try installing again.
December 6, 2012 at 10:34 pm
Robert Young
I’m getting the unloadNamespace issue documented in the RC messages various places:
namespace ‘plyr’ is imported by ‘stringr’, ‘scales’, ‘reshape2’, ‘ggplot2’ so cannot be unloaded
I don’t have devtools listed, and haven’t, so far as I know, installed dev versions of either ggplot2 or plyr. The RC threads talked about using a dev version of devtools, beyond standard .8. Aren’t we past that?
December 6, 2012 at 10:45 pm
winstonchang
That error message should only come up if you’re trying to install it with devtools.
If you’re seeing the following message when running install.packages(), it’s a different issue: “Warning in install.packages : package ‘plyr’ is in use and will not be installed”. This happens on Windows when plyr is already loaded in your R session and you try to upgrade it. plyr has a compiled DLL, and on Windows, that file can’t be replaced when the DLL is loaded. The solution is to start with a clean R session and run install.packages() from there.
December 6, 2012 at 11:02 pm
Robert Young
And the answer is, Rprofile. Listed both packages, and so… But shouldn’t the unloadNamespace work anyway?
December 6, 2012 at 11:22 pm
winstonchang
unloadNamespace won’t work when other loaded packages depend on the package that’s being unloaded. You would have to unload them all, in an order that doesn’t break any dependencies. Even if you did that, some packages that have DLLs aren’t well behaved and don’t unload their DLLs properly when the package is unloaded (I think the old version of plyr wasn’t well behaved, but the new version is).
On Unix-like systems, this means that, if you were to do unloadNamespace(‘plyr’), install the new version of plyr, then do library(plyr) without restarting your R session, you would have an old version of the plyr DLL running with the new version of the plyr R code. On Windows systems, you wouldn’t be able to upgrade the package at all, for the reasons I described previously.
One more thing: according to the documentation for dyn.unload(), on some platforms, unloading DLLs doesn’t work at all! So it’s generally a good idea to start with a clean R session when upgrading packages.
December 7, 2012 at 7:10 am
panorama
I get the following error messages:
The following `from` values were not present in `x`: col, color, pch, cex, lty, lwd, srt, adj, bg, fg, min, max
December 10, 2012 at 2:20 pm
winstonchang
I think this is the same package installation problem that others have mentioned… Please try reinstalling in a clean R session, without ggplot2 and plyr loaded. Before you install, run sessionInfo() to make sure that they aren’t loaded.
December 8, 2012 at 9:47 am
MAX
I got the following error when using the ggplot() function:
Errore in rename(x, .base_to_ggplot, warn_missing = FALSE) : non trovo la funzione “revalue”
(translated: can’t finde the function “revalue”)
Thank you for any help.
> sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: i386-pc-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=Italian_Italy.1252 LC_CTYPE=Italian_Italy.1252
[3] LC_MONETARY=Italian_Italy.1252 LC_NUMERIC=C
[5] LC_TIME=Italian_Italy.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
other attached packages:
[1] ggplot2_0.9.3
loaded via a namespace (and not attached):
[1] colorspace_1.1-1 dichromat_1.2-4 digest_0.5.2
[4] grid_2.15.1 gtable_0.1.2 labeling_0.1
[7] MASS_7.3-19 munsell_0.3 plyr_1.7.1
[10] proto_0.3-9.2 RColorBrewer_1.0-5 reshape2_1.2.1
[13] scales_0.2.3 stringr_0.6 tools_2.15.1
December 9, 2012 at 12:35 am
winstonchang
MAX, it appears you have the old version of plyr installed (1.7.1). Try installing the new version (1.8) with install.packages(“plyr”).
December 9, 2012 at 4:42 am
MAX
Yep, that was exactly the problem. Thank you so much.
January 12, 2013 at 2:33 pm
Paul Martin
I discovered another difficult combination. I upgraded to ggplot2 0.9.3 and plyr 1.8 and still had problems. I discovered that I was running R version 2.15.1, and ggplot2 was designed for R version 2.15.2. I upgraded to R version 2.15.2, and the software went back to its original success. This was a major relief; I had been concerned that ggplot2 0.9.3 represent a major redesign, but this was apparently wrong.