[R] S4 plot function (Package)...

Daniel Kosztyla kossi at cs.tu-berlin.de
Tue Jan 4 13:07:31 CET 2011


I have a problem programming 2 plot methods for 2 classes.
1. I have 2 classes. Each class has its own plot method. !!! How the 
plot,xxx-method.R -files have to look like,
so that the plot method for class 1 und plot methods for class 2 can act 
for each belonging class. Prob

My example for "plot_class1.R" for class labeled class1 (class2 

if (!isGeneric("plot")) {
   setGeneric("plot", function(x="class1", y="ANY", ...) 
standardGeneric("plot"), package="the_package_name");

setMethod("plot", signature(x="class1", y="ANY"),
   function(x, y, type="xy", method = names(x at misclass), anno="symbol", 
     ... #code


Looks it correct?
thx so far.

More information about the R-help mailing list