similar to: S4 class no longer accepts matrix in array slot under 2.0.1

Displaying 20 results from an estimated 10000 matches similar to: "S4 class no longer accepts matrix in array slot under 2.0.1"

2005 Jan 07
1
S4 class no longer accepts matrix in array slot under 2.0.1
I have an S4 class with a slot of class "array", and in upgrading to 2.0.1 (from 1.9.1) I have encountered a change in behaviour. This causes me some difficulties if I want to allow 2-dimensional arrays in the slot. The following (in 2.0.1) illustrates the point: > setClass("foo",representation("array")) [1] "foo" > a <-
2005 Jan 05
0
matrix no longer "is" array in 2.0.1?
I have an S4 class which extends array and has other slots, and in upgrading to 2.0.1 (from 1.9.1) I have encountered a change in behaviour. This causes me some difficulties if I want to allow 2-dimensional arrays in the slot (which I do). The following (in 2.0.1) illustrates the point: > setClass("foo",representation("array")) [1] "foo" > a <-
2009 Jun 18
1
validObject throws non-caught error when slot doesn't exist
I have been retooling an S4 class definition to include another slot and have found that the methods::validObject function (defined in methods/R/SClasses.R) in R-devel throws an error that isn't caught internally (and thus not controllable by 'test' argument) when retrieving a non-existent slot. The offending line of code is shown below: > validObject function (object, test =
2005 Apr 13
1
S4 extends a class, but .Data slot has different class
When I define an S4 class ("B" in the example below) that directly extends another ("A" in the example below) , which in turn directly extends another ("character" in the example below), I find that the slot does not have the class I specified in setClass(), it has the underlying class. Is this an intended feature? Briefly, the reason for using this type of
2009 Jun 29
1
S4 and connection slot [Sec=Unclassified]
Hi all, I am having a problem trying to declare a slot representation to hold a file connection. With V2.8.0 I had been using: setClass("Element", representation( [other slots removed], datafileConn = setOldClass(c("file","connection")) ) ) This resulted in a warning but still ran okay. No however with V2.9.0 I am getting
2004 Oct 15
1
cluster analysis
Hello. I wonder if anyone can help me with this. I'm performing cluster analysis by using hclust in stats package. My data are contained in a data frame with 10 columns, named "drops". Firs I create a distance matrix using dist: distanxe <- dist(drops) Then I perform cluster analysis via hclust: clusters <- hclust(distanze) At this point I want to view the tree
2009 Aug 12
1
calling a function with dynamically generated buttons
Hallo, I'm dynamically generating buttons depending on the number of rows of my dataframe. Every button is supposed to call a function which generates a plot with the values of one of my dataframe rows. My code looks like this: base <- tktoplevel() plotten <- function(mat, namen, titel) { midpts <- barplot(height=mat, names.arg = namen, main = titel, las=2)
2008 Feb 17
1
NAMESPACEs and S4 classes
I'd like to have two packages with S4 classes with the same name but different implementation. To that end I create a package tmpA with setClass("A", representation=representation( x="numeric"), sealed=TRUE) setClass("B", representation=representation( x="numeric")) B <- function(...)
2019 Jan 10
2
setClass accepts slot-mismatch between slots and prototype arguments
I was installing the 'diffobj' package into TERR and got an error from the call StyleSummary <- setClass("StyleSummary", slots=c(container="ANY", body="ANY", map="ANY"), prototype=list( container=function(x) sprintf("\n%s\n", paste0(x, collapse="")), body=identity, detail=function(x) sprintf("\n%s\n",
2020 Oct 05
2
S4 - inheritance changed by order of setClassUnion and setAs()
Dear colleagues, there is a behaviour with S4 (virtual) classes that I find very hard to understand: Depending on the position of setAs(), the tree of inheritance changes. This is my baseline example that defines the classes "grandma", "mother", "daughter" and a virtual class "mr_x". For a new instance if "daughter", "mr_x" is betweeen
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
2017 Jun 06
2
surprisingly, S4 classes with a "dim" or "dimnames" slot are final (in the Java sense)
Hi, It's nice to be able to define S4 classes with slots that correspond to standard attributes: setClass("A1", slots=c(names="character")) setClass("A2", slots=c(dim="integer")) setClass("A3", slots=c(dimnames="list")) By doing this, one gets a few methods for free: a1 <- new("A1", names=letters[1:3])
2008 Nov 26
1
S4 slot containing either aov or NULL
Dear listmembers, I would like to define a class with a slot that takes either an object of class aov or NULL. I have been reading "S4 Classes in 15 pages more or less" and "Lecture: S4 classes and methods" #First I tried with list and NULL setClass(listOrNULL") setIs("list", "listOrNULL") setIs("NULL", "listOrNULL") #doesn't
2017 Jun 06
1
surprisingly, S4 classes with a "dim" or "dimnames" slot are final (in the Java sense)
I've fixed this and will commit soon. Disregard my dim<-() example; that behaves as expected (the class needs a dim<-() method). Michael On Tue, Jun 6, 2017 at 5:16 AM, Michael Lawrence <michafla at gene.com> wrote: > Thanks for the report. The issue is that one cannot set special attributes > like names, dim, dimnames, etc on S4 objects. I was aready working on this >
2006 Apr 12
1
S4 class slot names
Hi, Why doesn't this work? setClass("test",representation(names="character")) tmp <- new("test") tmp@names <- "a" Error in "slot<-"(object, name, TRUE, value) : 'names' attribute [1] must be the same length as the vector [0] Why does this work (replace names with name)?
2008 Mar 26
5
S4 slot with NA default
Hi How do I specify an S4 class with a slot that is potentially numeric, but NA by default? I want the slot to be NA until I calculate its value (an expensive operation, not needed for all applications). When its value is known, I will create a new object with the correct value inserted in the slot. I want "NA" to signify "not known". My attempt fails because
2009 Aug 17
2
S4: inheritance of validity methods?
Dear Developers, In current implementation of validity method, objects are first coerced to superclass (slots are striped). Thus, it is not possible to write validity method which would perform some checks on children slots. Say, I want to check if number of slots in a class is equal to "n": setClass("A", representation(a="numeric", n="integer"),
2006 Jan 19
2
creating objects with a slot of class formula, using new
Hi, This works fine. >setClass("a",representation(b="list",c="list")) >new("a",b=list(7)) >An object of class "a" Slot "b": [[1]] [1] 7 Slot "c": list() But, now suppose you want a slot to accept an object of class formula... >setClass("a",representation(b="list",c="formula"))
2010 Sep 30
1
Assignment to a slot in an S4 object in a list seems to violate copy rules?
Dear R-developers I came across the following issue, which I find strange: setClass("A", representation(a = "numeric")) B <- list() myA <- new("A", a = 1) B$otherA <- myA B$otherA at a <- 2 myA at a Assigning a new value to slot 'a' in the _copy_ of myA stored in B$otherA changes the original value of myA -- this was surprising to me, and I
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")