similar to: Interaction between callNextMethod() and selectMethod()

Displaying 20 results from an estimated 4000 matches similar to: "Interaction between callNextMethod() and selectMethod()"

2005 Apr 20
1
callNextMethod()
I have built a sequence of eight S4 classes, each of which inherits from the previous one but adds extra slots. I have a corresponding generic function for which I have described methods for each of these classes in a signature with one other variable. There are also some ad hoc variable outside the signature which have different default values for each class. Each method calls
2002 Nov 05
1
function showMethods and inheritance
Hi, The following question might come from my (deep) misunderstanding of the concepts in the package 'methods'. I have a class 'A', and a class 'B' inheriting 'A' (so defined with 'setClass' and the parameter 'contains="A"'. The class A has a method 'mymethod'. A call to 'showMethods("mymethod")' return the
2019 Mar 14
2
selectMethod() can fail to find methods in situations of multiple dispatch
Here is an example: setGeneric("foo", function(x, y) standardGeneric("foo")) setMethod("foo", c("numeric", "ANY"), function(x, y) cat("I'm the foo#numeric#ANY method\n") ) Dispatch works as expected but selectMethod() fails to find the method: > foo(1, TRUE) I'm the foo#numeric#ANY method >
2011 Jun 01
1
Overloading S4 methods
Dear all, I am experiencing some problems with S4 method overloading. I have defined a generic for graphics:plot, using setGeneric("plot", useAsDefault = plot) and with importFrom('graphics', 'plot') and exportMethods('plot') in the NAMESPACE file of pkg A. I then proceed to define a method for signature c('myS4class', 'missing'). This works
2019 Mar 22
2
selectMethod() can fail to find methods in situations of multiple dispatch
Hi Michael, Thanks for looking into this. I suspect that truncation of ANY suffixes from method signatures is also the culprit behind the sudden breakage of aliases of the form \alias{foo,numeric-method} when a method without the ANY suffix in its signature gets added to the ecosystem. See my post about this to the Bioc-devel mailing list a couple of months ago:
2019 Mar 22
2
selectMethod() can fail to find methods in situations of multiple dispatch
Fine with me as long as eliminating the inconveniences associated with it can be put on the roadmap. The alias instability and the fact that the user has no way to know if s/he should do ?`foo,numeric-method` or ?`foo,numeric,ANY-method` to find the method has been a long-standing problem. H. On 3/21/19 21:29, Michael Lawrence wrote: If we started over, I'd try to avoid this sort of
2003 Jul 26
2
How to make "<-" generic?
Hi, perhaps a little bit unusual: is it possible to use "<- " as generic function with a new signature? The following example doesn't work: > isGeneric("<-") [1] FALSE > setClass("A",representation(x = "numeric")) [1] "A" > setClass("B",representation(x = "numeric")) [1] "B" > myAssign.A <-
2007 Dec 24
0
callNextMethod() with builtin group methods fails to create proper environment
Hi all, After all these years, I am finally porting some R-2.3.1-based S4 object code to R-2.6.1, dealing with all the S4 object system changes that came in R-2.4.0. I've run across what appears to be some sort of ommission in the implementation of callNextMethod() when used with primitives having group generic methods. In a stock R-2.6.1 patched (happens to be running on AMD64/RHEL 4, but
2011 Dec 09
1
'callNextMethod' in a '[<-' function does not work ?
Hi the list, I try to use callNextMethod in a setteur ([<-) but it does not work. Any raison ? Any other option ? --- 8< ------------------ ### Class B0 ### setClass("B0" , representation(b0 = "numeric")) setReplaceMethod("[","B0",function(x,i,j,value){x at b0 <- -value}) a <- new("B0") a at b0 <- 3 a a["b0"] <- 3 a
2010 Jul 20
1
Extract callNextMethod "array" calls "matrix"?
I have a class that extends array and my method for "[" stops with an error: > setClass("A", contains="array") [1] "A" > setMethod("[", "A", function(x, i, j, ..., drop = TRUE) new("A", callNextMethod())) [1] "[" > a<-new("A",array(1:12,c(4,3,1))) > a An object of class "A" , , 1
2003 May 21
1
callNextMethod
Hi, I don't understand why this code doesn't work (f(b2)): ///////////////// setClass("B0", representation(b0 = "numeric")) setClass("B1", representation("B0", b1 = "character")) setClass("B2", representation("B1", b2 = "logical")) f <- function(x) class(x) setMethod("f", "B0",
2010 Jan 13
1
bug in callNextMethod (PR#14185)
Hi, there seems to be a possible bug in callNextMethod in conjunction with the [-operator. Relevant info, minimal example and sessionInfo follow below: ############################### setClass("foo", representation = representation(a = "numeric")) setClass("bar", contains = "foo") setMethod( f = "[", signature =
2019 Mar 22
0
selectMethod() can fail to find methods in situations of multiple dispatch
If we started over, I'd try to avoid this sort of complexity, but "ANY" truncation has been happening since at least 2003. > matchSignature(c("numeric", "ANY"), foo) x "numeric" So I'm not sure we want to mess with it. Michael On Thu, Mar 21, 2019 at 8:14 PM Pages, Herve <hpages at fredhutch.org> wrote: > Hi Michael, >
2006 May 11
2
S4 initialize methods, unexpected recursive callNextMethod
Hi, Given a simple three class hierarchy: A <-- B <-- C I want to define an initialize method for each class such that when I call new("C", x=5), the initialize methods for A and B are used to incrementally build the object. When I do what seems obvious to me using callNextMethod, I get an infinite recursion. An example follows... setClass("A",
2019 Mar 22
0
selectMethod() can fail to find methods in situations of multiple dispatch
Agreed but I'm not sure we want users accessing documentation with those types of aliases. One option is the method?foo("numeric") syntax. On Thu, Mar 21, 2019 at 9:52 PM Pages, Herve <hpages at fredhutch.org> wrote: > Fine with me as long as eliminating the inconveniences associated with it > can be put on the roadmap. The alias instability and the fact that the user
2019 Mar 19
0
selectMethod() can fail to find methods in situations of multiple dispatch
This is due to the intentional truncation of ANY suffixes from method signatures. I've hacked selectMethod() to be robust to that and will commit soon. Thanks for the report. Michael On Thu, Mar 14, 2019 at 9:32 AM Pages, Herve <hpages at fredhutch.org> wrote: > Here is an example: > > setGeneric("foo", function(x, y) standardGeneric("foo")) > >
2012 Nov 06
2
Question on callNextMethod
I don't understand why I get the following results. I define two classes 'Base' and 'Derived', the latter of which 'contains' the first. I then define a generic method 'test' and overload it for each of these classes. I call 'callNextMethod()' in the overload for Derived. From the output, it appears that the overload for Base gets called twice. Why is
2010 Sep 23
1
strange behaviour of callNextMethod in S4 methods
Hello, I experienced a strange behaviour of callNextMethod when used in either initialize or any other S4 function method definition. Help says callNextMethod calls the next inherited method for the current function from where it is called with the same actual (non missing) arguments. This is OK. The problem appears when some formal arguments (in particular, S4 objects) of this function are
2006 Dec 11
1
Wondering about methods (selecting a less specialized method)
Hi All, I find myself wondering if there is a canonical means of achieving the multiple-dispatch version of 'super'? Specifically, I have a set of classes A, B, X and Y where B extends A and a method Foo with the signature (X,A,Y) and I'd like to implement Foo with the signature (X,B,Y) such that it calls Foo_(X,A,Y) and then does "other stuff." This gets a bit complicated
2007 Mar 04
1
Problem using callNextMethod() in S4
Dear all, Maybe, I am doing something wrong, but using R-2.5.0 on my Intel-Mac, I have problems using function callNextMethod() in method initialize. I am loading the following code as file "testS4.R": setClass("baseClass", representation(myname = "character", mydir = "character", "VIRTUAL"),