[R] with for objects

Roger D. Peng rpeng at jhsph.edu
Mon Dec 1 16:59:17 CET 2003


I'm not sure S4 objects are really meant to be used this way.  Maybe you 
  could write a plot method?

-roger

Hadley Wickham wrote:
> 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
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>




More information about the R-help mailing list