Displaying 20 results from an estimated 6000 matches similar to: "calling setGeneric() twice"
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
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 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
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
2013 Feb 02
1
setGeneric() gives "must supply skeleton" when checking package
r-devel,
In a development version of the CRAN package metrumrg, I write ...
require(reshape)
setGeneric('cast')
setOldClass(c('keyed','data.frame'))
setMethod('cast','keyed', function ...)
The result is satisfactory when sourcing the code directly, but when
checking the package (which has 'reshape' as a dependency in the
DESCRIPTION file) I get
2002 Jan 06
1
How to get setGeneric() to work?
Dear all, I can't see how setGeneric() works. I know perfectly well how to
define
library(methods);
setClass("Square", representation(side="numeric"));
# Will become the default method.
getArea <- function(object) {
stop(paste("Method getArea() is not defined for this class:",
data.class(object)));
}
setMethod("getArea",
2002 Jul 01
1
SetGeneric and formula interfaces
Hi,
while playing with the `methods' package I was not able to find what the
recommended way of dealing with the following problem is.
Suppose there is a generic function `foo' and two functions `foo.default'
and `foo.formula', in the classical way:
foo <- function(y, ...) UseMethod("foo")
foo.default <- function(y, ...) {}
foo.formula <- function(formula,
2006 Jan 25
2
Using substitute from inside an S4 method
Hi all,
I would like to access the name of a variable passed to an S4 method.
For a function, I would do this:
f <- function(x) as.character(substitute(x))
This also works for a the examples I have tried for methods that do
not have extra, non-dispatch args:
setGeneric("A", function(x, ...) standardGeneric("A"))
setMethod("A",
2009 Oct 23
2
mysteriously persistent generic definition
Originally I made a function yearStop that took an argument "object". I
made a generic, but later changed the argument to "x". R keeps
resurrecting the old definition. Could anyone explain what is going on,
or how to fix it? Note particularly the end of the transcript below: I
remove the generic, verify that the symbol is undefined, make a new
function, and then make a
2010 Feb 08
1
using setMethod or setGeneric to change S4 accessor symbol from @ to $
I created some S4 objects that are essentially data frame objects. The S4
object definitions were necessary to verify data integrity and force a
standardized data format. I am, however, finding myself redefining all the
typical generic functions so that I can still manipulate my S4 objects as if
they were data frames ... I have used setMethod to set methods for "subset",
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
2004 Dec 03
2
setGeneric(rm)
Hi,
We are developing a package using S4 classes. The S4 classes
are wrappers to C++ classes. So S4 classes contain an integer
that is the memory address of one C++ object. If an user
calls the rm() function, the C++ object must be deleted. But our generic
rm() function apparently doesn't work. Here is the code:
# The class
setClass("component",
2010 Sep 23
1
Behavior of R CMD build and library() w.r.t. setGeneric-like functions
Hello developeRs,
Apologies in advance for a rather long email, but to describe the
problem, I need to step through many details. I have been working on a
new dispatching system (futile.paradigm on CRAN) based on functional
programming concepts that is an alternative to S3 and S4 dispatching. I
use a declarative syntax using guard statements to control the
dispatching between function variants. I
2002 Sep 10
1
setGeneric(); R CMD check
1. Is it always the case that when defining generic functions in
a package, the package needs to be installed as a binary package
to avoid having the generic functions in the .GlobalEnv?
2. Defining a generic function in a "non-binary" package triggers
a check warning
$ R CMD check ...
...
* checking for code/documentation mismatches ... WARNING
Objects
2011 Aug 24
1
setMethods/setGeneric problem when R CMD CHECK'ing a package
R-helpers:
I'm trying to build a package, but I'm a bit new to the whole S3/S4
methods concept. I'm trying to add a new definition of the zoo
function "as.yearmon", but I'm getting the following error when it
gets to this point during a package install:
***
R CMD INSTALL STARStools
* installing to library
2009 Oct 27
1
How to reduce key strokes when defining S4 classes?
I feel tedious when I define a S4 class and the methods. For each
method, I have to call both setMethod and setGeneric (or both
setReplaceMethod and setGeneric). I would like a more compact grammar
so that I can reduce the key strokes. I'm wondering if there is a
better way available.
setClass(
Class='A',
representation=representation(
x='numeric'
)
2003 May 27
1
setGeneric?
In the last few days I've received couple of messages pointing out that our SparseM
package fails to install on the patched version of 1.7.0. Laurent Gaultier kindly
suggested that replacing:
setGeneric("as.matrix.csr")
by
setGeneric("as.matrix.csr", function(x, nrow, ncol, eps) standardGeneric("as.matrix.csr"))
was sufficient to fix the problem.
2005 Jul 20
1
Default arguments for setMethod() (PR#8021)
Full_Name: Bert Gunter
Version: 2.1.1
OS: Windows 2000
Submission from: (NULL) (192.12.78.250)
There appears to be either a bug or documentation problem in
setMethod/setGeneric with how default arguments are handled. The setMethod Help
says:
******
Method definitions can have default expressions for arguments. If those
arguments are then missing in the call to the generic function, the default
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
2010 Sep 03
3
S4 Method Signatures
Hello,
If the signature of a method defines which generic it implements then I'm confused about why this minimal example I invented won't work :
setGeneric("myFun", function(rs, ...){standardGeneric("myFun")})
setGeneric("myFun", function(cs, ...){standardGeneric("myFun")})
setMethod("myFun", "numeric", function(rs, colour =