R version 3.1.1 (2014-07-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
plyr_1.8.1
In trying to understand how ddply works, I ran the example given in the help file produced with... "?ddply"
Running the code returns:
"Error: argument "by" is missing, with no default"
(code below)
require(plyr)
dfx <- data.frame(
group = c(rep('A', 8), rep('B', 15), rep('C', 6)),
sex = sample(c("M", "F"), size = 29, replace = TRUE),
age = runif(n = 29, min = 18, max = 54)
)
ddply(dfx, .(group, sex), summarize,
mean = round(mean(age), 2),
sd = round(sd(age), 2))
I figured out the issue causing the error. In the help file the ddply function call should say "summarise" instead of "summarize".
Thanks. You saved me considerable time
I literally signed up for an account here just to say THANK YOU davparker. I could have been searching for that one for hours and hours ...
Thanks a lot davparker! I found this problem when using knit. But "summerize" works if I put the code directly into the console. Kinda weird...
Wow, thanks!! I spent hours trying to figure out!
It worked once with summarize and then after installing other packages it started throwing that error.
Thank you!
WOW that saved me alot of time
It's still in the slides for the Getting and Cleaning Data course in the Coursera Data Science track as of today (a year later) and still in the ?ddply help example.
Weird error. Thanks so much for the hint!
So glad to find this answer. I had been haunted by this error whenever I used the "weights" package with dplyr. Now, I can use both together if I simply write summarise instead of summarize...
Same with loading Hmisc after plyr. Followed the mask warning:
Attaching package: ‘Hmisc’
The following objects are masked from ‘package:plyr’:
is.discrete, summarize
Wow. I just spent hours with this bug. @jexa comment above totally helped me.
Was using dplyr summarize. Later, was playing around with hmisc. Didn't see the little warning about objects being masked because every package stomps on other package global namespaces.
So with hmisc installed I have to do use dplyr::summarise. Unloading hmisc allowed dplyr:summarize to work.
Thank god for Google finding this link.
This namespace issue is one of the primary reasons I use Python. The import pandas as pd concept, when you import a library, then prefix it's global namespace like pd.* prevents problems like the above.
this happened to me. summarize worked until it didn't, then summarise worked. thank you. the issue for me was installing the hmisc package as well.
face the same as all of you. was really useful thank you
Most helpful comment
I figured out the issue causing the error. In the help file the ddply function call should say "summarise" instead of "summarize".