[R] with for objects

Hadley Wickham h.wickham at auckland.ac.nz
Sun Nov 30 10:20:03 CET 2003


Is there a form of with (or an equivalent function) that can be applied 
to objects?

I'd like to be able to write something like (drawing from bioconductor + 
trellis as an example)
xyplot(maA ~ maM | maPrintTip, object = swirl[,1]) which would be 
interpreted as xyplot(swirl[,1]@maA ~ swirl[,1]@maM | 
swirl[,1]@maPrintTip) (or even better, match functions not slots eg. as 
xyplot(maA(swirl[,1]) ~ maM(swirl[,1]) | maPrintTip(swirl[,1])))

If there isn't, can any one offer any tips on writing such a function.  
I presume I'd have to deparse the formula, match the text with the 
slots/methods of the function, create the appropriate call objects and 
then call them?

Thanks for you help,

Hadley




More information about the R-help mailing list