similar to: S4 class slot name 'names' is not allowed (PR#8768)

Displaying 20 results from an estimated 9000 matches similar to: "S4 class slot name 'names' is not allowed (PR#8768)"

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 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)?
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",
2006 Apr 07
0
[R] documenting s4 methods in package
There are usually two directories involved in an install: the source directory and the install directory in R_HOME/library. The INSTALL procedure builds the package (usually in place in Windows, I'm not sure if that's the case in Unix) and installs it into the install directory by copying those files necessary to use it. REMOVE removes the install directory, cleaning up
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
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 =
2017 Jun 06
0
surprisingly, S4 classes with a "dim" or "dimnames" slot are final (in the Java sense)
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 and will have a fix soon. > a2 <- new("A2") > dim(a2) <- c(2, 3) Error in dim(a2) <- c(2, 3) : invalid first argument On Mon, Jun 5, 2017 at 6:08 PM, Herv? Pag?s <hpages at fredhutch.org> wrote: > Hi, > >
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 <-
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 <-
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 >
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
2016 Apr 23
0
S4 non-virtual class with no slots? [SOLVED]
Thanks, Martin, that (inherit from a virtual class) worked great. I already had a base class created with setUnion, and so this was an easy switch. I had assumed that since inheriting from a class without slots would produce a class without slots the result would still be virtual. Fortunately that's not the case. Ross ________________________________________ From: Martin Morgan
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"))
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
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
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