similar to: setGeneric(rm)

Displaying 20 results from an estimated 4000 matches similar to: "setGeneric(rm)"

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
2018 May 16
2
Dispatch mechanism seems to alter object before calling method on it
On 05/15/2018 09:13 PM, Michael Lawrence wrote: > My understanding is that array (or any other structure) does not > "simply" inherit from vector, because structures are not vectors in > the strictest sense. Basically, once a vector gains attributes, it is > a structure, not a vector. The methods package accommodates this by > defining an "is" relationship
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",
2010 Jan 24
1
recursive data-structures in R - An S4 "node" Class
Hi, In an effort to learn S4 objects, I am trying to port some c based tree code to S4 object. My immediate goal is to use .Call() interface for calling my c code from R. My long term goal is to understand how to write c structs that follows S4 classes and not the other-way-around. The c struct for the node is : typedef struct node{ int c; int n; inode **nodes; //length = n } inode; I
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 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",
2018 May 16
2
Dispatch mechanism seems to alter object before calling method on it
On 05/16/2018 10:22 AM, Michael Lawrence wrote: > Factors and data.frames are not structures, because they must have a > class attribute. Just call them "objects". They are higher level than > structures, which in practice just shape data without adding a lot of > semantics. Compare getClass("matrix") and getClass("factor"). > > I agree that
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 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",
2009 Oct 31
3
Plots with k-means
Hi, I'm doing a k-means cluster with 6 clusters and 15 variables. Any suggestions on how to plot the results? I've tried the standard xy plot, but couldn't get much of it. Thansk in advance, Iuri.
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'
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 =
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 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":
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
2008 May 10
2
Hashes as S4 Classes, or: How to separate environments
For learning purposes mainly I attempted to implement hashes/maps/dictionaries (Python lingua) as S4 classes, see the coding below. I came across some rough S4 edges, but in the end it worked (for one dictionary). When testing ones sees that the dictionaries D1 and D2 share their environments D1 at hash and D2 at hash, though I thought a new and empty environment would be generated each time
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' )
2010 Mar 15
2
Strange behavior of assign in a S4 method.
Hi the list, I define a method that want to change an object without assignation (foo(x) and not x<-foo(x)) using deparse and assign. But when the argument of the method does not match *exactly* with the definition of the generic function, assign does not work... Anything wrong? Christophe #------ Does not work ------#
2005 Mar 25
1
S4 methods semantics questions
Some quick questions about S4 methods. Does the typing of S4 methods mean that lazy evaluation is no longer possible? It seems that you would need to evaluate the arguments to determine their type at dispatch. Second, what role, if any, do default arguments play in S4 methods? I notice that you can put default arguments into generics but that the dispatch is still done on the type of the
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.