[Rd] callNextMethod() and NAMESPACE

Henrik Bengtsson hb at stat.berkeley.edu
Tue Apr 20 09:04:39 CEST 2010


It could be that you define the below in two different source files
and you are only updating the first and it is overwritten by the
second which you never edit? /Henrik

On Thu, Apr 15, 2010 at 4:21 PM, Adrian Waddell <adrian at waddell.ch> wrote:
> 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
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



More information about the R-devel mailing list