similar to: match gets confused by S4 objects

Displaying 20 results from an estimated 20000 matches similar to: "match gets confused by S4 objects"

2007 Apr 20
1
infinite recursion when printing former S4 objects
Hello all, An S4 class that contains matrix can be converted into a matrix using as(). When the resulting object is printed implicitly at the command line, all is well. When print() is explicitly called, I see an infinite recursion. Here is an example: ## create a subclass of matrix > setClass("Foo", representation(name="character"), contains="matrix")
2007 Jun 04
2
locked environment and inheritance
Hi, I have a S3 package with namespace called "myS3Pkg". Inside my package I would like to create a S4 class which extends (adds 2 slots) another S4 class from some other package. The class should be created in "myPkg" environment (and not global environment). Using: setClass("myS4class", representation("otherS4class", mydata = "numeric"),
2006 Apr 07
4
setIs and method dispatch in S4 classes
Dear all, I have a question regarding setIs and method dispatch in S4 classes: Consider the following example: ##################################################### ## A02 "contains" A01 by setIs: setClass("A01", representation(a="numeric",b="numeric")) setClass("A02", representation(a="numeric",d="numeric"))
2008 Sep 15
2
S4 coercion responsibility
Should functions or the user be responsible for coercing an S4 object argument containing the proper object (and thus should below be considered a bug in the packages or not)? The example is with RSQLite but the same thing happens with RMySQL, and other DBI packages. > library("RSQLite") Loading required package: DBI > m <- dbDriver("SQLite") > con <-
2006 May 11
2
S4 initialize methods, unexpected recursive callNextMethod
Hi, Given a simple three class hierarchy: A <-- B <-- C I want to define an initialize method for each class such that when I call new("C", x=5), the initialize methods for A and B are used to incrementally build the object. When I do what seems obvious to me using callNextMethod, I get an infinite recursion. An example follows... setClass("A",
2007 May 08
2
Problem calling $ inside a $ method
Hello, I wonder if this will make it through the spam filters given the subject line. I'm seeing the following when trying to call a dollar method inside of a dollar method. setClass("Foo", representation(d="list")) [1] "Foo" f <- new("Foo", d=list(bob=1, alice=2)) ## We can call dollar at this level and it works as expected
2007 Mar 15
4
R 2.5.0 devel try issue in conjuntion with S4 method dispatch
Hi, after updating R 2.5.0 devel yesterday we today observed many new unexpected failures in our daily package build and test system runs, which can be traced to recent changes in the implementation in try() (as noted in NEWS). Investigating this new implementation I come across an issue in conjuntion with using S4 classes and methods. try(expr) does not return an object with attribute
2007 Apr 26
1
Problem with R-2.5.0 patched and Matrix package
Hi, Using latest R 2.5.0 Patched, I'm unable to install the Matrix package from cran.fhcrc.org. I get: Creating a new generic function for "isSymmetric" in "Matrix" Creating a new generic function for "unname" in "Matrix" Error in conformMethod(signature, mnames, fnames, f) : In method for function "!": formal arguments omitted in
2006 Jan 03
1
S4 default initialization: unwanted NULL
The default initialization for slots of class "factor" and "data.frame" gives NULL. This seems odd, since those slots can't ever be set to NULL by the user. I would expect zero-length instances of factor and data.frame. Here is an example: setClass("FOO", representation(a="factor", b="data.frame", c="numeric")) [1] "FOO"
2007 May 28
2
S4 object slot of type 'call'
I'm using an S4 object with a slot of type 'call': I would like to be able to initialize it with something like NULL or NA (indicating that there is no information in the slot) but the value should comply with the fact that it must be of type call. Is there any simple way to obtain this? Thanks for any hint, Roberto -- <r/> | Roberto Brunelli - [scientist at Fondazione
2006 Apr 12
1
yet another problem with S4 dispatch (with setClassUnion)
Dear John and Seth, dear R-devels, once again the question of method dispatch in S4 -- this time with setClassUnion(); taking up your advice in https://stat.ethz.ch/pipermail/r-devel/2006-April/037200.html https://stat.ethz.ch/pipermail/r-devel/2006-April/037201.html I have been too quick in stating that >setClassUnion()---at least in my case---solves the problem; > The problem arises
2011 Jan 28
2
help with S4 objects: trying to use a "link-glm" as a class in an object definition
Hi, I'm trying to make a new S4 object with a slot for a "link-glm" object. R doesn't like me have a slot of class "link-glm" > class(make.link("probit")) [1] "link-glm" > setClass("a",representation(item="link-glm")) [1] "a" Warning message: undefined slot classes in definition of "a": item(class
2009 Jan 23
1
"for" loop wiht S4 Objects
Hi all, I'm working with the S4-Class system and I have a little problem with Implementing iteration functionality in my S4 class but it don't work: > setClass("foo",representation(bar="list")) > x <- new("foo",bar=list(1,2,3)) >for(e in x) cat(e) invalid type/length (S4/1) in vector allocation But when I extend from a
2007 Jul 16
1
S4 coerce
(I am not sure if this is a bug or a request for a more understandable warning, or possible something obvious I should be posting on r-help.) I am trying to coerce an new class object to be a DBIConnection and it does not work the way I think it should: R version 2.5.1 (2007-06-27) ... > require("RMySQL") # or require("RSQLite") Loading required package: RMySQL Loading
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 Jul 29
3
Object equality for S4 objects
To test two environments for object equality (Lisp EQ), I can use 'identity': > e1 <- environment(local(function()x)) > e2 <- environment(local(function()x)) > identical(e1,e2) # compares object identity [1] FALSE > identical(as.list(e1),as.list(e2)) # compares values as name->value mapping [1] TRUE # (is there a
2007 May 27
2
[Bioc-devel] promptClass
promptClass fails to identify methods associated with the class. Here is a fix: Index: promptClass.R =================================================================== --- promptClass.R (revision 41719) +++ promptClass.R (working copy) @@ -165,7 +165,7 @@ if (nmeths > 0) { .meths.body <- " \\describe{" for (i in 1:nmeths) { - .sigmat
2005 Nov 21
2
NAMESPACE, S4, and .onLoad
The Writing R Extensions manual instructs developers who use S4 classes and methods in a package with a name space to: There needs to be an .onLoad action to ensure that the methods package is loaded and attached: .onLoad <- function(lib, pkg) require(methods) I'm wondering if listing methods in the Depends field of the package's DESCRIPTION file is sufficient.
2006 Aug 28
2
S4 classes and objects -- fixed structure? No...
Hello. Suppose you define a new S4-class, say > setClass("track", representation(x="numeric", y="numeric")) Don't worry if you have a deja vu, it's from the help page. Your new class is said to have a fixed structure: two slots, x, and y, and that should apply to all objects you construct as members of that class. > tr <- new( "track" )
2006 Apr 20
1
S4 objects with list of objects as slots: how to subset?
Hello, I don't manage to see if you have already focussed on this point in some previous messages so I post my question: I have a little problem with the S4 style of programming. I tried to formalize my question: please consider the following example that you can run I think: #------------------ setClass("my.class1", representation( my.list =