Skip to content
Prev 163476 / 398502 Next

Non-interactive passing of quoted variables (ggplot, plyr, subset, transform, etc)

On Mon, Dec 1, 2008 at 11:06 AM, Vitalie Spinu <vitosmail at rambler.ru> wrote:
For subset, just do it by hand:

mydata[mydata[[X]] > 4, ]

For ggplot, see aes_string:

aes_string(x = X, y = Y)
which will do what you want

For plyr, you can use a character vector:

ddply(mtcars, c("cyl"), colwise(mean))
ddply(mtcars, c("cyl ^ 2", "vs - am"), colwise(mean))

In general you need to use substitute or bquote.

Hadley