From adrian at waddell.ch  Thu Apr 15 16:21:47 2010
From: adrian at waddell.ch (Adrian Waddell)
Date: Thu, 15 Apr 2010 10:21:47 -0400
Subject: [Rd] callNextMethod() and NAMESPACE
Message-ID: <4BC720FB.9080904@waddell.ch>

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



[Rd] callNextMethod() and NAMESPACE
Adrian Waddell