search for: setgenerator

Displaying 20 results from an estimated 344 matches for "setgenerator".

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
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
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
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",
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.
2014 Nov 25
0
problem with setGroupGeneric from package methods
Hi, There seems to be a problem with setGroupGeneric() from package 'methods'. The symptoms are somewhat erratic, in the sense that small changes may lead to any of the following behaviours. 1.Package works without problems on Windows and installs on Linux but gives error when loaded with library(). 2.Package installs on both systems and gives error when loaded on any of them. 3.
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")
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
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
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
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' )
2004 Jun 19
0
setGeneric / standardGeneric when args are not "literals" - corrected
This is a correction to my previous message, I forgot to swap two lines in the body of setMakeGenericMethod. Sorry about that. The correct (full message) reads like this: Hi, This works > setGeneric("clear", function(obj) standardGeneric("clear")) [1] "clear" but this doesn't. Why? > funName <- "clear" > setGeneric(funName,
2010 Apr 19
0
S4-based package failure: setGeneric example#1
I am a newbie package builder who successfully built a "Hello world" package but am now having trouble building a package with S4 functionality. I thought I would start by building a package consisting of just the first example under the setGeneric help page in a "fresh" 2.10.0 (windows) console (methods loaded at startup). The example: ## create a new generic function, with a
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
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
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
2006 Feb 14
3
S4 classes and methods with optional arguments
Hi, i have used S4 classes to implement a unified access to random number generators (package rstream on CRAN). I have used a construct to allow optional arguments: if(!isGeneric("rstream.sample")) setGeneric("rstream.sample", function(stream,...) standardGeneric("rstream.sample")) setMethod("rstream.sample",
2011 Jan 20
1
setGeneric for residuals, etc
I'm experimenting with a few model-fitting classes of my own. I'm leaning towards using S4 for my classes, but the R functions I'd want to override (residuals, predict, etc.) are all S3 methods. As I understand it, I could do setGeneric("residuals"), then add S4 specializations to it. However, I don't understand the full consequences of doing this. Are there any
2018 Apr 18
2
odd assignInNamespace / setGeneric interaction
A coworker got tired of having to type 'yes' or 'no' after quitting R: he never wanted to save the R workspace when quitting. So he added assignInNamespace lines to his .Rprofile file to replace base::q with one that, by default, called the original with save="no".. utils::assignInNamespace(".qOrig", base::q, "base")