Hello,

I am working my way through "A (not so) Short introduction to S4"

I created a class

setClass(Class = "Trajectories",
         representation = representation(times = "numeric",traj = "matrix"))

and tried to build a method using

setMethod(
          f = "plot",
          signature = "Trajectories",
          definition = function(X, y, ...){
            matplot(x@times, t(x@traj), xaxt = "n", type = "l", ylab = "",
xlab = "", pch = 1)
            axis(1, at = x@times)
          }
        )

R responds with an error message:

Creating a generic function for ‘plot’ from package ‘graphics’ in the
global environment
Error in conformMethod(signature, mnames, fnames, f, fdef, definition) :
  in method for ‘plot’ with signature ‘x="Trajectories"’: formal arguments
(x = "Trajectories", y = "Trajectories", ... = "Trajectories") omitted in
the method definition cannot be in the signature

Did anything change in the transition to R-3.0?

is there any other, more recent introduction to S4 classes recommended?

Thank you

for your help.

Andreas

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to