Displaying 20 results from an estimated 7000 matches similar to: "Caching bug with showMethods?"
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
2005 Jun 02
1
showMethods doubt
Hi,
I'm developing in S4 and I wanted to see the methods for a specific
class using showMethods but I didn't succed. Can someone help ? See the
example below.
setClass("myclass",
representation(
name ="character"
)
)
setGeneric("mymeth", function(obj, ...){
standardGeneric("mymeth")
}
)
setMethod("mymeth",
2013 Feb 14
4
2 setGeneric's, same name, different method signatures
hi. below is a small test case (hopefully minimal, though i'm still a
bit confused about initializers).
i would have guessed (and maybe i still would have been right) that one
could re-use the name of a generic function for functions with different
numbers of arguments. in the case below, class A's bB() queries the
status of a single A object, so bB(A) (where here "A" is an
2010 Mar 16
1
Problem with S3 to S4 transition
Hello to everybody
I am developing a package using R and have the following problem:
I used to work in a mixture of S3 and S4 mechanism environment: as a
matter of fact, I used to define my classes (say "DB" for illustration)
using the setClass function (with representation field), and
I was using the S3 implicit mechanism writing the functions: print.DB
and plot.DB.
Recently, I
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
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>
2011 Jan 26
1
Problem with "setMethod" in R package
Dear all,
My apologies for re-posting this question, but I have not found any
solution to my problem so far. I also think that my post may have been
overseen due to the posting time and high traffic on this list.
I experience a problem in implementing a S4 class in a package and would
appreciate your help in this matter.
The class is implemented using Rcpp, which works well. I then extend
2006 May 22
2
confused by inheritance...
Hi r-devels,
I am stuck in some S4 inheritance problem:
setClass("A",representation(a="numeric"))
setClass("A1",representation(b="numeric"),contains="A")
setClass("A2",representation(c="numeric"),contains="A1")
if(!isGeneric("foo")){
setGeneric("foo", function(x,y,z, ...)
2020 Feb 18
2
Possible Regression in setClassUnion between 3.5.0 and 3.6.0
I am trying to create a class union of class unions to facilitate method
dispatch. When I execute code in the global environment, everything acts as
expected, however when I put the same code in the context of a package,
selectMethod can no longer find the correct method. This first block below
puts the code in the context of a package:
fn <- "codefile.R"
writeLines(
c(
2012 Oct 01
1
False positive note about ambiguous dispatch
Hi,
In the situation below the note issued by the dispatch algo doesn't
seem right:
setClass("A", representation(stuff="complex"))
setAs("ANY", "A", function(from) new("A", stuff=as.complex(from)))
> as(6, "A")
An object of class "A"
Slot "stuff":
[1] 6+0i
> as(6L, "A")
2011 Aug 23
1
Implementing a "plugin" paradigm with R methods
Dear list,
I was wondering how to best implement some sort of a "plugin" paradigm
using R methods and the dispatcher:
Say we have a function/method ('foo') that does something useful, but
that should be open for extension in ONE specific area by OTHERS using
my package. Of course they could go ahead and write a whole new 'foo'
method including the features they'd
2020 Feb 19
2
Possible Regression in setClassUnion between 3.5.0 and 3.6.0
Thanks, I'll look into it.
On Tue, Feb 18, 2020 at 8:32 AM Ezra Tucker <ezztucker at gmail.com> wrote:
>
> Hi Robert,
>
> This looks like a bug to me (tested in R 3.6.2 on Windows), f(new("a"))
> should return "hi!". I'll add that this DOES work properly in 3.6.1
> which leads me to suspect this could be due to the subtle change in the
> way
2009 Feb 15
1
Overloading in R
I have been trying to write a new class that reimplements the vector
class. As a test of my overloading I decided to try and and call
t.test on two vectors which were objects of my class rather than the
default class.
The overloaded length I wrote seems to work correctly. I used
setMethod("length", "myvector", ...)
setMethod("mean", "myvector", ...)
2013 Mar 13
1
S4 generic not exported correctly / incorrect dispatch?
In this post
https://stat.ethz.ch/pipermail/bioc-devel/2013-March/004152.html
a package author reports that S4 dispatch fails. I can reproduce this with a
PkgA (attached; 'intervals' is a relatively light-weight CRAN package) that has
DESCRIPTION with
Depends: intervals
Imports: graphics
NAMESPACE:
importFrom(graphics, "plot")
export("plot")
2009 Nov 25
1
group generics
I have classes A and B, where B contains A. In the implementation of
the group generic for B I would like to use the corresponding group
generic for A. Is there a way to do that?
I would also appreciate any comments if what I'm trying to do seems like
the wrong approach.
Here's a stripped down example:
setClass("A",
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 =
2014 Jul 11
1
Namespaces and S4 Generics
I've installed R-devel
R Under development (unstable) (2014-07-09 r66111)
Platform: x86_64-apple-darwin13.1.0 (64-bit)
and am trying to resolve some problems that I am seeing with my
SparseM package. In prior versions I explicitly had:
setGeneric("image", function(x, ...) standardGeneric("image"))
and then used setMethod to define a method for the class matrix.csr
but
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
2020 Feb 26
1
Possible Regression in setClassUnion between 3.5.0 and 3.6.0
Okay - that makes sense and thanks for looking into this! As an aside, from
R-devel's perspective would you say methods are stabilizing again or do you
foresee a lot of changes coming in the 4.* series?
On Tue, Feb 25, 2020 at 3:39 PM Michael Lawrence via R-devel <
r-devel at r-project.org> wrote:
> This seems to work as expected (returning "hi!") in R-devel, but there