Displaying 20 results from an estimated 6000 matches similar to: "mysteriously persistent generic definition"
2007 Jan 31
2
Problems with definitions of S4-generics
Hello all,
I'd like to report a problem related to S4 classes.
Platform:
Mac G4/400 PCI (PPC-architecture)
Mac OS 10.4.8
R 2.4.1 for Mac OS X (CRAN binary, 2006-12-19) w/ R.app 1.18
Last December, Simon Urbanek confirmed that the issue is not platform
related, and that it is most likely a bug. He suggested to post my report
to "the appropriate mailing list" -- I choose r-devel.
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
2024 Mar 15
2
Spurious warning in as.data.frame.factor()
>>>>> Ivan Krylov
>>>>> on Thu, 14 Mar 2024 14:17:38 +0300 writes:
> On Thu, 14 Mar 2024 10:41:54 +0100
> Martin Maechler <maechler at stat.math.ethz.ch> wrote:
>> Anybody trying S7 examples and see if they work w/o producing
>> wrong warnings?
> It looks like this is not applicable to S7. If I overwrite
>
2010 Jan 21
1
Rgeneric.py assists in rearranging generic function definitions
I've attached a script I wrote that pulls all the setGeneric definitions
out of a set of R files and puts them in a separate file, default
allGenerics.R. I thought it might help others who find themselves in a
similar situation.
The "situation" was that I had to change the order in which files in my
package were parsed; the scheme in which the generic definition is in
the
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,
2007 Mar 29
0
S4 generic surprise
I discovered the following behavior when source'ing the same file
repeatedly as I edited it. My generic stopped acting like a generic. I
can't tell from the docs what, if any, behavior is expected in this
case. R 2.4.0
> foo <- function(object) 3
> isGeneric("foo")
[1] FALSE
> setMethod("foo", "matrix", function(object) 4)
Creating a new
2024 Mar 15
1
Spurious warning in as.data.frame.factor()
>>>>> Martin Maechler
>>>>> on Fri, 15 Mar 2024 11:24:22 +0100 writes:
>>>>> Ivan Krylov
>>>>> on Thu, 14 Mar 2024 14:17:38 +0300 writes:
>> On Thu, 14 Mar 2024 10:41:54 +0100
>> Martin Maechler <maechler at stat.math.ethz.ch> wrote:
>>> Anybody trying S7 examples and see if they work
2009 Dec 17
5
?setGeneric garbled (PR#14153)
Full_Name: Ross Boylan
Version: 2.10.0
OS: Windows XP
Submission from: (NULL) (198.144.201.14)
Some of the help for setGeneric seems to have been garbled. In the section
"Basic Use", 5th paragraph (where the example counts as a single line 3rd
paragraph) it says
<quote>
Note that calling 'setGeneric()' in this form is not strictly
necessary before calling
2008 Mar 13
3
Sealed for setGeneric
Hi the list
When two setGeneric occurs on the same function, the second erage the
first and erase all the function previously define.
Is it possible to prevent that ? Is it possible to declare a setGeneric
that can not be erased later ?
Something like the |sealed for setMethod...|
||
|Thanks|
||
Christophe
2010 Jan 19
1
calling setGeneric() twice
Is it safe to call setGeneric twice, assuming some setMethod's for the
target function occur in between? By "safe" I mean that all the
setMethod's remain in effect, and the 2nd call is, effectively, a no-op.
?setGeneric says nothing explicit about this behavior that I can see.
It does say that if there is an existing implicity generic function it
will be (re?)used. I also tried
2005 Jun 02
1
Too generic with S4 methods?
I tried the following (relevant excerpt only)
setMethod("likelihood",
signature(spec="Specification", covs="vector",
states="vector"),
function(spec, covs, states) {
####
setMethod("likelihood",
signature(model="Model", path="matrix"),
function(model, path) {
This
2024 Mar 14
1
Spurious warning in as.data.frame.factor()
On Thu, 14 Mar 2024 10:41:54 +0100
Martin Maechler <maechler at stat.math.ethz.ch> wrote:
> Anybody trying S7 examples and see if they work w/o producing
> wrong warnings?
It looks like this is not applicable to S7. If I overwrite
as.data.frame with a newly created S7 generic, it fails to dispatch on
existing S3 classes:
new_generic('as.data.frame', 'x')(factor(1))
#
2012 Nov 21
1
S3 generic/method consistency issue with R CMD check
Hi,
I'm having some trouble setting methods for the qr family of functions. I
believe I have distilled my misunderstanding in the code snippet below:
foo <- function(x, ...) UseMethod("foo")
foo.default <- function(x) { }
# foo
setGeneric(name = "foo", useAsDefault = foo)
setMethod("foo", signature(x="bar"),
function(x, ...) { }
)
2009 Jun 05
2
Problem with generic methods
Hi
I want to create a new generic method, but I end up with an error
(evaluation nested too deeply). see the transcript below.
The function beginYear.Fun() works, but not beginYear.
I have no idea why.
Any ideas welcome,
Rainer
> setClass("fun", representation(x = "numeric"))
[1] "fun"
> new("fun")
An object of class ?fun?
Slot "x":
2006 Dec 28
1
setGeneric and file order in a package
Are there any assumptions I can make about the order in which
different files in the R package subdirectory will be evaluated? For
example, will it be alphabetical in the file names? Will case
distinctions be ignored?
I ask because I would like to use setGeneric, as in
setGeneric("foo", function(x) standardGeneric("foo")) and am wondering
where that should go.
I realize I
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
2009 Mar 10
1
S4 generic masking S3 generic when using namespace
Hi,
I have two example packages, test1 and test2, where the only code in
them is:
setGeneric("predict", function(object, ...) standardGeneric("predict"))
(get them from http://www.cs.mu.oz.au/~gabraham/test1.tar and
http://www.cs.mu.oz.au/~gabraham/test2.tar)
The difference between them is that first does not have a namespace, and
loads fine. The second has a namespace
2005 Jan 19
2
signif() generic
Dear list,
I'm trying to write a class for Gaussian error propagation of measured
values and their (estimated) errors,
> setClass("sec", representation(val="numeric", err="numeric"))
I've already successfully implemented basic arithmetics using mostly the
"Arith" group generics. But I'm running into trouble when trying to get
signif() to
2009 Nov 04
1
s4 generic issue
I'm hoping that someone with deeper insight into S4 than I,
that is to say virtually everyone reading this list, could help
resolve the following problem in SparseM. We have
setGeneric("backsolve",
function(r, x, k = NULL, upper.tri = NULL, transpose = NULL,
twice = TRUE, ...)
standardGeneric("backsolve"),
useAsDefault= function(r, x,
2006 Oct 19
1
default arguments in generics and methods
i believe the following is true but would appreciate confirmation
that it is intended behavior and will continue:
if a default argument is employed in the definition of a generic
function, and the generic is called with the argument in question
(call it 'ARG') missing, then the method for signature (..., ARG =
"missing", ...) will be called by 'standardGeneric'