Hi:
ggplot2 is now at version 2.1.0 on CRAN, and Hadley is in the process
of writing an update to the book, anticipated to be published later
this year AFAIK. The 2009 book is now obsolete in several significant
ways, notably the theming system and some new/improved features in
facet_wrap() and facet_grid() added in version 2.0.0. Much in ggplot2
has changed since the book was published in 2009. If you want to get a
glimpse of the new version, Google 'github ggplot2-book'.
Note that qplot() has been deemphasized in the new book, to the point
where it isn't even mentioned except for a link citation to the first
edition on the
ggplot2.org page, which I suspect you've already found.
It's in your best interest to learn ggplot() instead of qplot(); it
has a higher learning curve at first, but it has far more potential
for creativity than does qplot() and is more consistent and flexible
in terms of its syntax. Even in the original book, Hadley noted that
qplot() was supposed to be a way to transition from base graphics to
ggplot2 graphics; in other words, qplot() is ggplot() on training
wheels. (This is a biased opinion, as I made a point of avoiding
qplot() from the time I started learning ggplot2 several years ago.)
As for the code that threw the error you mentioned, the arguments
mentioned in the error message sound like they come from loess(),
which means you probably tried to use geom_smooth() somewhere in your
code, probably as a second argument to geom = in qplot(). A similar
problem was posted to this list a few months ago. Don't do this; use
ggplot() instead. qplot() behaves unpredictably at times when you pass
more than one geom in a single qplot() call, especially if you are
trying to pass arguments to one of the geoms but not the other. Here
is a short reproducible example to illustrate the problem and a couple
of workarounds:
library(ggplot2)
# Works
qplot(disp, mpg, data = mtcars, geom = c("point", "smooth"))
# Throws an error
qplot(disp, mpg, data = mtcars, geom = c("point", "smooth"), span = 0.5)
# qplot workaround
qplot(disp, mpg, data = mtcars, geom = "point") +
geom_smooth(span = 0.5)
# ggplot() equivalent
ggplot(mtcars, aes(x = disp, y = mpg)) + # base layer
geom_point() + # points layer
geom_smooth(span = 0.5) # smoothing layer
As the other reply mentioned, if you had provided a minimal
reproducible example, one might be better positioned to help you solve
your immediate problem. See the link at the bottom of this message for
further details of how one might do that.
Dennis