similar to: S4 class slot names

Displaying 20 results from an estimated 10000 matches similar to: "S4 class slot names"

2006 Apr 13
0
S4 class slot name 'names' is not allowed (PR#8768)
Martin, Thanks! I'll use name for now. Steve -----Original Message----- From: Martin Maechler [mailto:maechler at stat.math.ethz.ch] Sent: Thursday, April 13, 2006 3:11 AM To: Steven Lacey Cc: R-bugs at stat.math.ethz.ch; r-help at stat.math.ethz.ch Subject: S4 class slot name 'names' is not allowed >>>>> "SteveL" == Steven Lacey <slacey at
2006 Apr 13
0
S4 class slot name 'names' is not allowed (PR#8767)
>>>>> "SteveL" == Steven Lacey <slacey at umich.edu> >>>>> on Wed, 12 Apr 2006 19:06:52 -0400 writes: SteveL> Hi, Why doesn't this work? setClass("tests", representation(names = "character")) tmp <- new("tests"); tmp at names <- "a" SteveL> Error in
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"))
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
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])
2005 Jan 09
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 <-
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 >
2012 Feb 21
1
Why cant my S4 class have a slot named `C`?
Hi all, This feature was throwing me for a loop for quite some time until I played with the names of the slots. Consider exhibit A: ============== setClass("SVM", representation=representation( x='numeric', y='numeric', C='numeric', eps='numeric'), prototype=prototype( x=numeric(),
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 =
2006 Jun 15
0
S4 class slot name 'names' is not allowed (PR#8768 S4Methods)
Hello, Besides the problem with using "names," one has a similar problem using ".Data" together with "VIRTUAL." Consider the top of p. 295 of the green book. This should work (I had to change "structure" to "junk" because "structure" is a sealed class definition): setClass("junk",
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 <-
2007 May 21
1
list element names in S4 class extending list
can list names attributes be preserved through S4 class containment? seems to be so but only if the containment relationship is direct ... see below. > setClass("c1", contains="list") [1] "c1" > l1 = list(a=1, b=2) > o1 = new("c1", l1) > names(o1) # pleasant surprise [1] "a" "b" > setClass("c2",
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
2009 Aug 28
1
S4: names stripped during instantiation of grandchildren of numeric class
Dear All, A small inconsistency (it's probably not even a buglet): > setClass("A", contains="numeric") [1] "A" > names(new("A", c(a=23))) [1] "a" > setClass("B", contains="A") [1] "B" > names(new("B", c(a=23))) NULL > This is exactly that kind of behavior S4 was invented for, you
2006 Apr 06
3
skipping rows in trellis key
Hi, I would like to add a key to my trellis plot using draw.key. Here is what I want: 3 x 6 key where the first row is a header. row 1: empty, "S-R Mapping", "R^2" row 2: pch=17, "Color", 0.951 row 2: pch=17, "Shape", 0.934 ect... The problem is that I would like the cell in the upper left corner to be empty (a placeholder) with the remaining
2010 May 12
1
slot assignment in S4 classes
Hi R friends,   I'm still studying S4 classes and I have a question about slot assignment. Why would I have to use a special setter method [example 2 below] if I can assign data to a slot directly when I call new() [example 1 below]?   ## first way to do it (the idiosyncratic way?) setClass(Class = "TestClass", representation = representation(myDf = "data.frame"))
2016 Apr 22
2
S4 non-virtual class with no slots?
It seems that if an S4 class has no slots it can't be instantiated because it is assumed to be virtual. Is there a way around this other than adding a do-nothing slot? A singleton would be OK, though is not essential. Problem: EmptyFitResult <- setClass("EmptyFitResult", representation=representation()) # also tried it without the second argument. same result. > e <-
2009 Jun 30
1
S4 class redefinition
I haven't found much on S4 class redefinition; the little I've seen indicates the following is to be expected: 1. setClass("foo", ....) 2. create objects of class foo. 3. execute the same setClass("foo", ...) again (source the same file). 4. objects from step 2 are now NULL. Is that the expected behavior (I ran under R 2.7.1)? Assuming it is, it's kind of
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