Displaying 20 results from an estimated 5000 matches similar to: "False positive note about ambiguous dispatch"
2007 May 01
1
Possible problem with S4 dispatch
Hi,
First a bit of disclaimer... I haven't isolated this problem into an
easy to reproduce case, and I won't be surprised if the root cause is
a fault in my code's use of name spaces or some such.
The error I'm seeing is one in which the desired method is not found.
What worries me in terms of my expectations of how to debug the
problem is that showMethods and selectMethod both
2013 Jul 02
2
cache most-recent dispatch
Hi,
S4 method dispatch can be very slow. Would it be reasonable to cache the
most
recent dispatch, anticipating the next invocation will be on the same
type? This
would be very helpful in loops.
fun0 <- function(x)
sapply(x, paste, collapse="+")
fun1 <- function(x) {
paste <- selectMethod(paste, class(x[[1]]))
sapply(x, paste,
2009 May 18
1
S4 method dispatch and namespaces: why is default method selected
Hi,
I ran into the following peculiarity involving S4 method dispatch and
namespaces.
I develop a package which have a namespace and which depends on 'pixmap'
package, which itself does not have a namespace.
Now, in my package I have a class which has a slot for objects from
class "pixmap" and I
want to have a "plot" method for this new class. Not to clutter the
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
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
>
2012 Mar 24
2
RC / methods package
(I think this is being caused by the new methods package in RC.)
In the RC (March 24) some of my packages are generating a Note
Note: Method with signature "MySQLConnection#integer" chosen for
function "coerce",
target signature "TSMySQLConnection#integer".
"dbObjectId#integer" would also be valid
This is coming from a call to dbGetQuery() in package
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:
2014 Feb 19
0
dispatch on "c" method when passing named arguments
Hi,
Many S4 objects in Bioconductor support "combining" via a "c" method.
A common use case is to combine a collection of S4 objects stored in
a list with the following idiom:
do.call("c", list_of_objects)
For many users this doesn't return what they expect though, because
their 'list_of_objects' is a named list and this seems to "break"
2008 Aug 27
1
S4 coercion
I am extending a DBI connection by
setClass("TSPostgreSQLConnection",
contains=c("PostgreSQLConnection","TSdbOptions"))
but the first time I use this I am getting a warning when it tries to
coerce the TSPostgreSQLConnection to a PostgreSQLConnection. After the
first use the warning stops, but the first warning is causing me
problems when I do automatic checks
2008 Nov 25
2
dots methods: dispatch issues
There seems to be a bug arising when using multiple S4 generics with "..."
as the signature.
The following code works as expected:
##############################################################
> setGeneric("rbind", function(..., deparse.level=1)
standardGeneric("rbind"),
+ signature = "...")
Creating a generic for "rbind" in
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
2009 Jul 29
1
RFC: methods() and showMethods() {was "debug"}
(a new thread, on purpose)
>>>>> "RobG" == Robert Gentleman <rgentlem at fhcrc.org>
>>>>> on Mon, 27 Jul 2009 16:55:50 -0700 writes:
RobG> Hi, I just committed a change to R-devel so that if
RobG> debug is called on an S3 generic function, all methods
RobG> will also automatically have debug turned on for them
RobG>
2016 Mar 04
2
as.vector in R-devel loaded 3/3/2016
I see as below, where getGeneric and getMethod imply a different signature; the signature is mode="any" for both cases in R version 3.2.3 Patched (2016-01-28 r70038)I don't know how to reproduce Jeff's error, though.
> library(Matrix)
> as.vector
function (x, mode = "any")
.Internal(as.vector(x, mode))
<bytecode: 0xe79f88>
<environment:
2010 Mar 31
1
as(1:4, "numeric") versus as.numeric(1:4, "numeric")
Hi,
> class(as(1:4, "numeric"))
[1] "integer"
Surprising but an explanation could be that an integer
vector being a particular case of numeric vector, this
coercion has nothing to do because 1:4 is already numeric.
And indeed:
> is.numeric(1:4)
[1] TRUE
> is.numeric(as(1:4, "numeric"))
[1] TRUE
However, 'as(1:4,
2006 Oct 17
1
Caching bug with showMethods?
showMethods isn't reporting inherited methods when it is first
called. The methods are there and after calling them, showMethods
gives the right output.
Here is an example (using R-devel r39647):
setClass("A", representation(x="numeric"),
prototype=list(x=1))
setClass("B", contains="A",
prototype=list(x=2))
2006 Apr 09
2
type converters not being saved to workspace
Any one can explain why this happens or any work arounds?
> setClass('foo')
[1] "foo"
> setAs('foo', 'character', function(from) from)
> showMethods('coerce')
Function "coerce":
from = "ANY", to = "array"
from = "ANY", to = "call"
from = "ANY", to = "character"
from =
2006 Apr 09
2
type converters not being saved to workspace
Any one can explain why this happens or any work arounds?
> setClass('foo')
[1] "foo"
> setAs('foo', 'character', function(from) from)
> showMethods('coerce')
Function "coerce":
from = "ANY", to = "array"
from = "ANY", to = "call"
from = "ANY", to = "character"
from =
2007 Apr 12
3
Method dispatch for print() in package its
Dear all,
in the package its the print() method does not seem to correctly work in all circumstances:
> selectMethod(print, "its")
Method Definition:
function (x, ...)
{
print(x@.Data <mailto:x@.Data> , ...)
}
<environment: namespace:its>
Signatures:
x
target "its"
defined "its"
> fundPME.lst[[1]]$irr
An object of
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"))
>
>
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,
>