From hb at stat.berkeley.edu  Tue Apr 20 09:04:39 2010
From: hb at stat.berkeley.edu (Henrik Bengtsson)
Date: Tue, 20 Apr 2010 09:04:39 +0200
Subject: [Rd] callNextMethod() and NAMESPACE
In-Reply-To: <4BC720FB.9080904@waddell.ch>
References: <4BC720FB.9080904@waddell.ch>
Message-ID: <k2r59d7961d1004200004j6cd197a6led23261ab0107cbf@mail.gmail.com>

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
>



[Rd] callNextMethod() and NAMESPACE
Henrik Bengtsson