The error message says it: in R, the arguments for the generic function "[" include i and j; the method definition must include those as well. Do getGeneric("[") or ?"[" to see the arguments.

As has been said on the R mailing lists in the past, R is generally compatible with the published books, but not when there is a better approach. Having the extra arguments allows methods to be based on the class of the row or column indices.


wolski wrote:


Hi!

Trying to reproduce some examples from "Programming with Data" page 341.
Can not reproduce it neither on R1.8.1. nor R1.9.0devel?


library(methods) setClass("track",representation(x="numeric",y="numeric"))

setMethod("["
          ,"track"
          ,function(x,...,drop=T){
            track([EMAIL PROTECTED],[EMAIL PROTECTED])
          }
          )

In method for function "[": Expanding the signature to
include omitted arguments in definition: i = "missing",
j = "missing"
Error in .MakeSignature(new("signature"), def, signature) :
        The names in signature for method (x, , ) don't match function's arguments (x, 
i, j, drop)

The same....
setReplaceMethod("[","track"
,function(x,...,value)
{
[EMAIL PROTECTED](value,"numeric") }
)



Please Help. Eryk.

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




--
John M. Chambers                  [EMAIL PROTECTED]
Bell Labs, Lucent Technologies    office: (908)582-2681
700 Mountain Avenue, Room 2C-282  fax:    (908)582-3340
Murray Hill, NJ  07974            web: http://www.cs.bell-labs.com/~jmc

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to