hadley/plyr — pull request #99 by wch (2012-10-10 02:54:31+00:00)
Title: First try at fix for scoping issues

This is an attempt at a fix for #3.

It seems to do the right thing for the example code:

```
# Generate some data
set.seed(321)
myD <- data.frame(
Place = sample(c("AWQ","DFR", "WEQ"), 10, replace=T),
Light = sample(LETTERS[1:2], 15, replace=T),
value=rnorm(30)
)

myfunc <- function(xdf, sctype) {
force(sctype)
ddply(xdf, .(Place, Light), transform,
rng = paste(value, sctype))
}

myfunc(myD, "range")
```

It also fixes the behavior for this question on stackoverflow: http://stackoverflow.com/questions/6955128/object-not-found-error-with-ddply-inside-a-function

Some notes:

* It passes all the tests! (And it could probably use some new ones)
* I don't know how performance is with `do.call` vs. calling the function directly.
* I've only implemented it for `ddply`, `ldply`, and `llply`.