[Rd] callNextMethod() and NAMESPACE
Adrian Waddell
adrian at waddell.ch
Thu Apr 15 16:21:47 CEST 2010
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 at shortnames)) == FALSE)){
return(x[,match(j,x at 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
More information about the R-devel
mailing list