similar to: S4 object does not commute? (PR#13209)

Displaying 20 results from an estimated 300000 matches similar to: "S4 object does not commute? (PR#13209)"

2008 Oct 28
0
Arith ops dropping S4 bit [Was: S4 object does not commute? (PR#13222)
The asymmetry is just the symptom of a more fundamental issue: There are no operator methods currently defined for "vector" classes, either combined with each other or with a non-S4 object. The consequence is that computations drop through to the primitive C code. Not a good idea, because that code does various things to objects with attributes, some of them bizarre and most of them
2008 Oct 30
0
(PR#13209) Arith ops dropping S4 *and* 'object' bit [Was: ...]
>>>>> "JMC" == John Chambers <jmc at r-project.org> >>>>> on Tue, 28 Oct 2008 11:50:38 -0400 writes: JMC> The asymmetry is just the symptom of a more fundamental JMC> issue: There are no operator methods currently defined JMC> for "vector" classes, either combined with each other JMC> or with a non-S4 object.
2005 Aug 05
1
S4 setClass with prototypes " issues" (PR#8053)
To R-Developers: I wish to report what I believe are inconsistencies between Green Book descriptions and R methods behaviors. I **realize** that R does not guarantee total consistency with the Green Book; therefore I leave it to you to decide whether any of this is a bug, design choice, or a need for additional documentation -- or whether I have simply misread or overlooked existing explanations.
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")
2008 May 04
1
S4 / S3 / Sweave problem
I'm not sure if this as a bug or something I am doing wrong. It occurs in both 2.7.0 and 2.6.2. require("methods") setClassUnion("OptionalPOSIXct", c("POSIXct", "NULL")) setClass("TSmetax", representation(serIDs="character", ExtractionDate="OptionalPOSIXct" )) setGeneric("TSmetax", def= function(x,
2011 Mar 06
1
Seeking guidance in package creation when it contains s4 class
Dear all, I am having problem to create a package when this package is supposed to have some newly created s4 class. Here is my workout: > #rm(list = ls()) > setClass("aClass", sealed=T, representation(slot1 = "vector", slot2 = "character")) [1] "aClass" > fn1 <- function(x, y, z) { + x <- x[1] + y <- y[1] + z <- as.character(z[1]) +
2006 Sep 14
1
attributes of S4 objects
I am having a bit of a struggle deciding when to use attributes with S4 objects. Clearly the 'class' attribute will always be present. But it is not clear to me whether the architects of the methods package intend that other attributes, such as 'names', will still be used when the S4 implementation is complete. I notice that, when you create a formal object from an
2010 Feb 26
1
S4 programming
Dear all, I'm new to S4 classes and have a question on this. I want to use S4 because I want to define explicitly the slots that the new class can have. But other than that, the new class behaves exactly like a list. But this will not allow me to use the generic functions that are already defined for class "list", such as "$", "c", "[[",
2018 May 21
1
S4 class slot type S4 class
All, I am considering creating an S4 class whose slots (2) are both S4 classes. ?Since an S4 slot can be an S3 class I figure this can be done. ?However, the correct syntax of which I am unsure. ?Reviewing the docs I have come to the following conclusion: SetClass('myfoo', ? ? ? ? ? ? ? ? ? slots = (foo1, foo2)) Without a type I believe each slot is .Data. ?A get method on the above
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
2008 Mar 30
1
package.skeleton.S4
Hi the devel list. I am adapting the package.skeleton to S4 classes and methods I would have been very proud to post a new working function on this list. Unfortunately, I do not manage to solve all the problems. Mainly - sys.source does not compile a file with setClass - dumpMethod does not exists yet In the following code, thise two problems are notified by a line ################# Still
2010 Jul 12
1
S4 class extends "data.frame", getDataPart sees "list"
R-Devel: When I get the data part of an S4 class that contains="data.frame", it gives me a list, even when the "data.frame" is the S4 version: > d<-data.frame(x=1:3) > isS4(d) [1] FALSE # of course > dS4<-new("data.frame",d) > isS4(dS4) [1] TRUE # ok > class(dS4) [1] "data.frame"
2005 Aug 31
1
Bug in copying of S4 objects (PR#8112)
If I have an S4 object, and I make a copy, changes to the original aren't reflected in the copy: > setClass("foo", representation(slot="numeric")) > x <- new("foo", slot=1) > y <- x > x at slot <- 2 > y An object of class "foo" Slot "slot": [1] 1 This is as it should be. However, if I call the slot assignment
2003 Oct 09
1
S4 group generic Complex not working (PR#4483)
The Complex group generic for S4 methods is not working: > setClass('foo', representation(z='complex')) [1] "foo" > setMethod('Complex', 'foo', function(z) callGeneric(z@z)) [1] "Complex" > Arg(new('foo', z=1+0i)) Error in Arg(new("foo", z = 1 + (0+0i))) : non-numeric argument to function > The fix is
2012 Nov 05
1
no method for coercing this S4 class to a vector
all of a sudden, after a SparseM upgrade(?) I get this error: > str(z) Formal class 'matrix.csr' [package "SparseM"] with 4 slots ..@ ra : num [1:85372672] -0.4288 0.0397 0.0104 -0.1843 -0.1203 ... ..@ ja : int [1:85372672] 1 2 3 4 5 6 7 8 9 10 ... ..@ ia : int [1:699777] 1 123 245 367 489 611 733 855 977 1099 ... ..@ dimension: int [1:2] 699776 122
2008 Dec 22
1
How to add a slot to S4 class of an existing package?
Dear all, Since my package is based on S4 classes, I would like to know how to add a slot to an existing S4 class without breaking the code of users of my package. Assume the following S4 class: setClass("MyClass", representation(name = "character", type = "character", data = "data.frame" ), prototype(name =
2011 May 14
1
By default, `names<-` alters S4 objects
Hi, I was stumped by this. The two S4 objects below looked exactly the same: > a1 An object of class "A" Slot "aa": integer(0) > a2 An object of class "A" Slot "aa": integer(0) > str(a1) Formal class 'A' [package ".GlobalEnv"] with 1 slots ..@ aa: int(0) > str(a2) Formal class
2009 Mar 06
1
array subsetting of S4 object that inherits from "array"
Hi, I have an S4 class that inherits from "array" but does not add generic implementations of the "[" method. A simplified example is: setClass("fooarray", contains="array") If I create a "fooarray" object and subset it with a one-dimensional index vector, the return value is of class "fooarray". Other variants (see below), however,
2016 Sep 22
1
as.character.factor and S4 object containing factor
Do I mess up something or is this a bug? If I define an S4 object that contains "factor", all the tests indicate that it is a factor but as.character.factor() complains of it being a non-factor... > setClass("Foo", contains="factor") > a <- new("Foo", factor(1:3)) > a Object of class "Foo" [1] 1 2 3 Levels: 1 2 3 > class(a) [1]
2010 May 17
1
format.data.frame containing S4 class with format method
Hi again, I must be misunderstanding something fundamental about how an S4 class stored in a data.frame can be persuaded to print according to a desired format. The help page says: format.data.frame formats the data frame column by column, applying the appropriate method of format for each column. Here is my class: > setClass("A",contains="character") [1] "A"