Displaying 20 results from an estimated 43 matches for "callgenerated".
2006 May 10
1
What is callGeneric used for?
I've recently come across two pieces of code using calls to
callGeneric() inside the definition of a method.
In both cases, it appears to me that the callGeneric call could be
replaced with a "real" call to the generic, say foo(x) instead of
callGeneric(x) inside method foo.
My understanding from the docs is that when called with arguments, it
is just like calling the actual
2004 Jun 07
1
Lazy Evaluation?
Hello,
I've stumbled upon following problem, when trying to overload the methods
for group Math for an S4-class which contains functions as slots.
setClass("NumFunction", representation = list(fun = "function"))
NumFunction <- function(f) new("NumFunction", fun = f)
square <- function(x) x^2
NF <- NumFunction(square)
2012 Jul 22
0
callGeneric(...) and lazy evaluation
There seems to be an issue with passing "..." to callGeneric(), because it
assumes that the call can be evaluated in the parent frame. Due to lazy
evaluation, that is often not going to work for arguments that are simply
passed down via "...".
Here is an example:
setClass("A", contains = "character")
setClass("B", contains =
2006 May 09
1
YA S4 method dispatch question
I recently encountered this and was wondering if someone
could explain what happened. Basis of question involves
what the difference between the calls makes as the end
result is the same:
> identical(matrix(1:8, nrow = 1), array(1:8, c(1, 8)))
TRUE
If I run the code below as shown, I get the following:
> foo(1:8, 4)
foo (vector, numeric)
val = 4
foo (matrix, ANY)
val = 500
foo
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",
2010 Aug 26
1
Passing arguments between S4 methods fails within a function:bug? example with raster package.
Dear all,
This problem came up initially while debugging a function, but it
seems to be a more general problem of R. I hope I'm wrong, but I can't
find another explanation. Let me illustrate with the raster package.
For an object "RasterLayer" (which inherits from Raster), there is a
method xyValues defined with the signature
2005 Jun 20
3
How to define S4 methods for '['
Folks:
This is a question about the S4 formal class system.
Suppose I have a class, 'foo', defined by:
setClass('foo',representation(dat='matrix', id='character') )
I wish to define a '[' method for foo that will extract from the 'dat' slot.
I would have thought that the following would work, but it doesn't:
2009 Jun 15
1
S4: Bug in group method defenition ("Compare")
Dear UseRs,
Setting methods for groups ("compare" in this case) does not work
properly. Once one method is set ,redefining it or even removing does not
change the behavior:
setClass("foo"
,representation(range="numeric")
)
#[1] "foo"
setMethod("Compare",c(e1="ANY",e2="foo"),
function(e1,e2){
browser()
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
2004 Jun 26
1
S4 group "Math", "getGroupMembers", "genericForPrimitive"
Hi,
I found the following on Windows 2000/NT
R Version 1.9.1 (2004-06-21) (also Version 1.9.0):
The S4 group "Math" doesn't work as documented; i.e., "log", "log10",
"gamma" and "lgamma" are included
in the documentation but don't work. See example code below.
Moreover, what about 'genericForPrimitive' which is used
in
2013 Feb 14
1
mapply error with Math (S4 group generic)
I get an error when using self-defined (not standard) functions with mapply
with S4 objects from the raster package that I develop: "Error in
as.character(sys.call(sys.parent())[[1]]) : cannot coerce type 'closure'
to vector of type 'character'". Does anyone understand why? The problem is
illustrated below. Thanks, Robert
> # First a general example that works
2005 Dec 29
1
trouble with S4 methods for group "Summary"
Hello. This question concerns the Methods package. I have created a
new class and am trying to set a method for it for S4 group generic
"Summary". I have run into some signature problems. An example:
> setClass("track", representation(x="numeric", y="character"))
[1] "track"
> setGeneric("max", group="Summary")
2006 Apr 12
1
S4 method dispatch matrixOrArray
I have some code where the primary dispatching is on
other parameters so I'd like not to have to create a
set of functions for "matrix" and another duplicate
set for "array". But the class union technique isn't
working as implemented below and I don't have my Green
book with me. How do I fix my infinite recursion problem?
2008 Feb 29
1
inheritence in S4
Hi the list
I define a class A (slot a and b), a class C (slot c and d) and a class
E that inherit from A and B.
I define print(A) and print(B). For print(C), I would like to use both
of them, but I do not see how...
Thanks for your help...
Christophe
----------------------------------------------------------------
Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre
2003 Oct 09
1
S4 group generic Complex not working (PR#4483)
The Complex group generic for S4 methods is not working:
> setClass('foo', representation(z='complex'))
[1] "foo"
> setMethod('Complex', 'foo', function(z) callGeneric(z@z))
[1] "Complex"
> Arg(new('foo', z=1+0i))
Error in Arg(new("foo", z = 1 + (0+0i))) :
non-numeric argument to function
>
The fix is
2005 Jul 19
1
S4 Dispatching
Is it possible for S4 to (continue) dispatch to a class
created during dispatching? The code below doesn't work;
is this not possible or have I ommitted something?
Concept was to create a SEXP with R_AllocatePtr, give it
a class attribute, and continue dispatch. Example code
below omits multiple parameters that can be different types.
Essentially, any parameter would be converted to an
2008 Aug 07
1
'"ts" treated as a registered S3 class, but keep its "structure" behaviour' ?
Dear all,
In R-devel I have noticed the new approach for the "ts" class in the
package "methods".
the "structure" behaviour of "ts" is not always kept when one uses
"ts" objects and objects of classes which extend the virtual class
"structure".
As a short example:
## this works fine
setClass("foo", representation(header =
2006 Apr 13
2
[R] S4 method dispatch matrixOrArray (fwd)
What a delicious example! (I'm taking the liberty of sharing it with
r-devel, since it raises some good issues.)
You have two questions, presumably:
1 - how could the order of the setMethod calls make a difference in the
results?
2 - what's causing the infinite loop & how could it be avoided, reliably?
Second question first. The danger sign is the "vector" method:
2005 Oct 05
0
Asterisk 1.0.9-BRIstuffed-0.2.0-RC8o memory leak when using call files ?
Hi all,
I'm using Asterisk 1.0.9-BRIstuffed-0.2.0-RC8o on box A with a TE410P
(EuroISDN cpe)
connected to another similar asterisk box B acting as EuroISDN master.
I'm performing some load tests by contiously feeding up to concurrent 30
call files to /var/spool/asterisk/outgoing/ on box A
which inititate via a dialplan context/extension a outbound call
(redirected via chan_local) to
2006 Aug 30
1
setMethod() and log()
Hi
I am having difficulty with setMethod(). I have a "brob" class of
objects whose
representation has two slots: "x" and "positive". Slot "x" (double)
holds the log
of a number and slot "positive" (logical) its sign. The idea is
that large numbers
can be handled.
I'm trying to implement a log() method using an analogue of the