I am revising a paper for submission and would like to replace the old lattice graphics with shiny new ggplot2 versions. However, I run into compatibility problems between ggplot2 and two packages that are absolutely crucial for my analyses, coin and arm. When executing the following example from the manual
qplot(sleep_rem / sleep_total, awake, data = msleep)
I get an error message saying:
Error in function (classes, fdef, mtable) :
unable to find an inherited method for function "empty", for signature "data.frame"
as soon as either coin or arm are loaded.
Here are the details:
Running R 2.10.1, empty .RData file
require(ggplot2)
require(xtable)
require(MASS)
require(gdata)
require(car)
require(Hmisc)
require(psych)
qplot(sleep_rem / sleep_total, awake, data = msleep)
require(coin)
qplot(sleep_rem / sleep_total, awake, data = msleep)
require(arm)
qplot(sleep_rem / sleep_total, awake, data = msleep)
Is this reproducible with R 2.12? If not, might it be worth upgrading? I must confess I am loath to update a working system, especially when on a tight deadline.
It’s only the coin package that seems incompatible. Reason is that one of the packages loaded together with
coin(modeltoolsto be exact) also contains a functionempty()that masks the functionempty()of plyr. Updating to R 2.12 won’t change a darn thing, as both packages are contributed by other authors. You should mail the author of the ggplot package and tell him to specifyplyr::empty()in his code. Or even the guys from theplyrpackage, as the problem might actually be there.A possible hack could be :
This works on 2.11.1 using following data frame:
Make sure you remove
emptyfrom the workspace right after plotting. Otherwise you might get trouble with the other packages that are loaded. You’ll have to do that with every plot you make after you loaded the packagecoin.