Am getting error w/ as_df function

42 views
Skip to first unread message

bobp

unread,
Oct 19, 2010, 1:05:32 PM10/19/10
to ggplot2
Having gotten back to ggplot2 (updated it and reshape2, and plyr), I'm
consistently getting the error:
This using code pasted from HW's webpage. This is one example of
many.
qplot(carat, price, data = dsmall, geom = c("point", "smooth"),
+ method = "gam", formula = y ~ s(x))
Error in aesdefaults(data, .$geom$default_aes(), mapped_vars) :
could not find function "as_df"
Any help will be appreciated. Thanks, bp

Joshua Wiley

unread,
Oct 19, 2010, 1:27:44 PM10/19/10
to bobp, ggplot2
Hi BP,

Would you mind specifying where from Hadley's website you copied the
code? I poked around the ggplot2 part, and could not find it. Making
some guesses I tried:

library(ggplot2)
dsmall <- diamonds[1:100, ]
library(mgcv) # gam function

and got something that seemed to work fine. Is dsmall not a data
frame? Also, you mentioned you updated ggplot2, reshape2, and
plyr....what about R (2.12.0 was released Friday).

Cheers,

Josh

> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> Please provide a reproducible example: http://gist.github.com/270442
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2


--
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/

Jonathan Christensen

unread,
Oct 19, 2010, 8:21:21 PM10/19/10
to bobp, ggplot2
It works fine for me:

> library(ggplot2)
Loading required package: reshape
Loading required package: plyr

Attaching package: 'reshape'

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

round_any

Loading required package: grid
Loading required package: proto
> library(mgcv)
This is mgcv 1.6-2. For overview type 'help("mgcv-package")'.
>
> set.seed(1410) # Make the sample reproducible
> dsmall <- diamonds[sample(nrow(diamonds), 100), ]
>
> qplot(carat, price, data = dsmall, geom = c("point", "smooth"), method = "gam", formula = y ~ s(x))
> sessionInfo()
R version 2.11.1 (2010-05-31)
i386-apple-darwin9.8.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] grid stats graphics grDevices utils datasets methods
[8] base

other attached packages:
[1] mgcv_1.6-2 ggplot2_0.8.8 proto_0.3-8 reshape_0.8.3 plyr_1.2.1

loaded via a namespace (and not attached):
[1] lattice_0.19-13 Matrix_0.999375-44 nlme_3.1-97
>

Can you give the output of sessionInfo()?

Jonathan

Reply all
Reply to author
Forward
0 new messages