Hello there,

I define a accessor method for one of my classes, i.e.

setMethod(f = "[",
  signature = "NG_data",
    definition = function(x,i,j,drop){
       if(all(is.na(match(j,x...@shortnames)) == FALSE)){
         return(x[,match(j,x...@shortnames)])                           }else{
         callNextMethod()
       }
    }
)

where the class "NG_data" inherits from the "data.frame" class. Hence I added the line

exportMethods("[")

to my NAMESPACE file. After package building, installing and loading, I try to use this accessor method

myObject[,1]

but I get the error message:

Error in callNextMethod() : bad object found as method (class "function")

Interestingly, if I then execute the setMethod(f = "["... in the command prompt

myObject[,1]

works. Does anybody has a clue what could go wrong?


Adrian Waddell

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to