Error: could not find function "ddply"

18,966 views
Skip to first unread message

Paul

unread,
Apr 14, 2012, 5:24:40 PM4/14/12
to ggplot2
Hi - I'm trying to work through the examples found here http://tinyurl.com/c9jvmys
but after loading library(ggplot2) i can't find 'ddply', or 'melt' for
that matter. i'm on a windows 7 machine. I'm not an R expert, but not
a novice either, but this has me beat Any help would be appretiated.

Cheers
Paul

Stuart Luppescu

unread,
Apr 15, 2012, 2:37:08 PM4/15/12
to ggp...@googlegroups.com

ggplot2 doesn't load those automatically. To get ddply you have to load
plyr; reshape2 for melt.
library(plyr)
library(reshape2)

--
Stuart Luppescu -=- slu .at. ccsr.uchicago.edu
University of Chicago -=- CCSR
鐃緒申文鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申 -=- Kernel 3.2.1-gentoo-r2
Trevor Hastie: It would be great to have a 'clickable' digest, where
the topics list is a set of pointers, and clicking on a topic takes you
to that entry. Jeff Gentry: I sincerely hope you don't mean that you
wish HTML enabled content in the actual emails coming through the
mailing list. People who send HTML in email text should be taken out
back and shot :) Peter Dalgaard: Pretty much what my spam filter does...
Well, it kills the

R. Michael Weylandt

unread,
Apr 15, 2012, 2:30:23 PM4/15/12
to Paul, ggplot2
You also need to load the plyr package with library(plyr). That should
make ddply available.

It used to be that plyr was added to the search path upon loading
ggplot2, but with the namespace redesign ddply isn't automatically
exported.

Michael

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

Derek Borba

unread,
Apr 15, 2012, 2:43:43 PM4/15/12
to Paul, ggplot2
ddply is part of the plyr package
melt is part of the reshape2 package

plyr: 
Check the Split-Apply-Combine link
http://plyr.had.co.nz/ 

Also check Hadley's short courses
http://courses.had.co.nz/ # Multiple short courses on Hadley's packages
http://courses.had.co.nz/09-user/   #Short course for PLYR


reshape2:
http://cran.r-project.org/web/packages/reshape2/reshape2.pdf
 
Derek


Paul

Derek Borba

unread,
Apr 15, 2012, 2:52:58 PM4/15/12
to Paul, ggplot2
Here's a talk Hadley gave with examples of how on use plyr and ggplot2 in concert -- very helpful if you're new to the packages.
http://www.youtube.com/watch?v=TaxJwC_MP9Q

Derek

Susan

unread,
Mar 26, 2016, 8:12:43 AM3/26/16
to ggplot2
I had the same issue, but running code that worked in the past. I have R 3.1.1 and recently updated plyr to 1.8.3. Got an error when using ddply (with plyr loaded). Adding reshape2 (suggested below) fixed the problem. 
Reply all
Reply to author
Forward
0 new messages