Trying to learn plyr, I have gotten stuck trying to reproduce code from the introductory guide.
The guide says that the code is in a file plyr.r, but not where I can find this file.
But reproducing one of the first examples seemed easy enough, so I decided to give it a try:

dat <- data.frame(c(10,100,50), mean=c(5,5,10), sd=c(1,2,1))
maply(dat, rnorm)
and I get this error:
Error in function (..., na.last = TRUE, decreasing = FALSE) :
unimplemented type 'list' in 'orderVector1'
trying
dat <- cbind(c(10,100,50), mean=c(5,5,10), sd=c(1,2,1))
maply(dat, rnorm)
gives
Error: Results must have the same dimensions.
questions:
- what am I doing wrong?
- where can I find plyr.r? (it is not here)
The data frame you made has a header (col.names) which is not compatible with the rnorm function. See:
And the m*pply function do not know what to do with the ‘c.10..100..50…’ column.
As you can see in the docs (
?mdply), the following example works like a charm:If you really want different number of observations with the different parameters, you should not use mdply, because the matrix/data.frame must have the same number of columns. Insted use
mlply, e.g.: