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

Vitalie Spinu vitosmail at rambler.ru
Mon Dec 1 18:06:15 CET 2008


Hello Everyone,
May be a silly question.

How to pass programmatically variables which are not known in advance and  
are quoted? Variables are quoted implicitly in  functions like "subset"  
and "transform" and explicitly in ggplot and plyr.

For instance I would like to have something like this:

myfunc<-functon(mydata,X) subset(mydata,X>4)
myfunc<-function(mydata,X,Y) {ggplot(mydata,aes(x=X,y=Y))+geom_points()}

this does not work since X and Y are not in mydata.

Many, many thanks,
Vitalie.



More information about the R-help mailing list