[R] ggplot2(0.9.0): could not find function "=="

J Toll jctoll at gmail.com
Wed Feb 1 21:10:14 CET 2012


Hi,

I have a question related to the newest version of ggplot2 (0.9.0).  I
just updated this morning and from CRAN it looks like the Mac version
is the only one at 0.9.0 as of right now.

http://cran.r-project.org/web/packages/ggplot2/index.html

Anyway, I was in the midst of a project where I was trying to
replicate "Back-to-back Bar Charts" in this blog post.

http://learnr.wordpress.com/2009/09/24/ggplot2-back-to-back-bar-charts/

My project and the example in the blog post no longer work with 0.9.0.
 I just want to figure out how to fix the blog example, and then make
the same changes to my own work.

So this is the output:

> library(ggplot2)
> library(plyr)
> library(reshape)

Attaching package: ‘reshape’

The following object(s) are masked from ‘package:plyr’:

    rename, round_any

> trade <- read.csv("http://pastie.org/pastes/629247/download", header = TRUE, stringsAsFactors = FALSE)
> balance <- ddply(trade, .(Time), summarise, balance = sum(EXP - IMP))
> trade.m <- melt(trade, id.vars = c("BEC", "Time"))
> ggplot(trade.m, aes(Time)) + geom_bar(subset = .(variable ==
+     "EXP"), aes(y = value, fill = BEC), stat = "identity") +
+     geom_bar(subset = .(variable == "IMP"),
+              aes(y = -value, fill = BEC), stat = "identity") +
+                  xlab("") + scale_y_continuous("Export  -  Import",
+                                                formatter = "comma")
Error in continuous_scale(c("y", "ymin", "ymax", "yend", "yintercept",  :
  unused argument(s) (formatter = "comma")
> ggplot(trade.m, aes(Time)) + geom_bar(subset = .(variable ==
+     "EXP"), aes(y = value, fill = BEC), stat = "identity") +
+     geom_bar(subset = .(variable == "IMP"),
+              aes(y = -value, fill = BEC), stat = "identity") +
+                  xlab("") + scale_y_continuous("Export  -  Import")
Error in eval(expr, envir, enclos) : could not find function "=="

The problem appears to be with the subsetting.  Apparently something
has changed between the versions.  I've been trying to read about the
changes between versions but so far have found so smoking gun.  Any
thoughts or suggestions as to the problem would be appreciated.

Thanks,

James



More information about the R-help mailing list