similar to: help with S4 objects: trying to use a "link-glm" as a class in an object definition

Displaying 20 results from an estimated 10000 matches similar to: "help with S4 objects: trying to use a "link-glm" as a class in an object definition"

2015 May 28
3
S4 inheritance and old class
Hey everyone, I would like to develop a package using S4 classes. I have to define several S4 classes that inherits from each others as follow: # A <- B <- C <- D I also would like to define .DollarNames methods for these class so, if I have understood well, I also have to define an old class as follow: # AOld <- A <- B <- C <- D setOldClass(Classes = "AOld")
2015 May 12
2
Unexpected failure when calling new() with unnamed arg and
Hi, The man page for new() suggests that if 'a' is an object with slots "slot1" and "slot2" and C is a class that extends the class of 'a', then the 2 following calls should be equivalent: new("C", a, ...) new("C", slot1=a at slot1, slot2=a at slot2, ...) This is generally the case but I just ran into a situation where it's not.
2012 Dec 12
1
Lost in S4 and S3 classes
Hi all, this is my first post in R devel? sorry if I lost some of the guidelines. Anyway this is my problem: Version: R version 2.15.2 (2012-10-26) Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) I want to make an S4 class that use the output object of the function of nls.lm as a slot: setOldClass("nls.lm") setClass ( Class="TestClass",
2015 May 13
2
Unexpected failure when calling new() with unnamed arg and
Thanks Martin for looking into this. H. On 05/13/2015 03:57 AM, Martin Maechler wrote: >>>>>> Herv? Pag?s <hpages at fredhutch.org> >>>>>> on Tue, 12 May 2015 15:18:42 -0700 writes: > >> Hi, > >> The man page for new() suggests that if 'a' is an object with slots >> "slot1" and "slot2" and C is a
2009 Sep 15
2
S3 objects in S4 slots
Hello, I am the maintainer of the stringkernels package and have come across a problem with using S3 objects in my S4 classes. Specifically, I have an S4 class with a slot that takes a text corpus as a list of character vectors. tm (version 0.5) saves corpora as lists with a class attribute of c("VCorpus", "Corpus", "list"). I don't actually need the
2015 Oct 08
1
Unexpected failure when calling new() with unnamed arg and
>>>>> Joshua Wiley <jwiley.psych at gmail.com> >>>>> on Thu, 8 Oct 2015 12:19:16 +1100 writes: > Hi, I realize this is an old thread, but just wondering > whether a conclusion was ever reached on this issue? I'm > using formula(NULL) but it would be nice if default > initialization worked for formula classes as well. Well,
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"),
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
2008 Apr 15
1
Pb with validObject(..., complete=TRUE)
Hi, When called with complete=TRUE, validObject() is supposed to work in a recursive manner. But here is a situation where it doesn't seem to be the case. Let's define a class with a validity method: setClass("PosInts", representation(ii="integer")) setValidity("PosInts", function(object) { if (!all(object at ii > 0))
2006 Mar 06
1
validObject does not check validity of slots
The documentation for validObject suggests that slots are checked for validity, but validObject seems only to check that the slot has something claiming to be correct; validObject(obj) does not perform the equivalent of validObject(obj at y) for slot y. This is also the second problem issue reported in http://tolstoy.newcastle.edu.au/R/devel/05/03/0151.html Relevant documentation, an example,
2010 May 06
1
Validity glitch when contains="matrix"
Sirs: My validity function did not run when my class contains="matrix". But if I first define the class with contains="numeric", then define it again with contains="matrix", validity runs. Here's the session: > f <- function(object) "BAD CLASS" # force error to > setClass("A", contains="matrix", validity=f) [1]
2004 Sep 30
1
Problem with _new_ if class "lm" in object representatio n.
Hi, But "any" rises some other problems well known from S3. One has "any" for "free" in S3. You don't need S4. . But I know how "if" polluted functions look like in S3. They are hard to understand and to maintain. Hence I am quite happy to use S4. Type-checking is usefull if you program with data. Also if you are on the "C side" of the
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 =
2003 Aug 24
2
setClass question
I would like to add a class to the SparseM package. I have a class "matrix.csr" that describes a matrix in compressed sparse row format, now I would like a class matrix.diag.csr that describes such objects when they happen to be diagonal. The idea is that matrix.diag.csr objects should behave (later in life) exactly like matrix.csr objects, the distinction is only needed in order to
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
2008 Apr 09
1
coerce methods and inheritance
Hi, It doesn't seem that the dispatching algo is finding my coerce method under some circumstances. Let's say I have 2 classes, A and AA and that AA is just a direct extension of A with no additional slots: setClass("A", representation(ii="integer")) setClass("AA", contains="A") I can define a method for coercing my objects to an integer
2009 Oct 26
1
Why 'validity' is not called? (S4)
I thought that 'validity' defined in 'setClass' should be called in 'new'. Could somebody let me know why 'validity' is not called? How to make it be called? > setClass( + Class='A', + representation=representation( + x='numeric' + ), + validity=function(object){ + cat("~~~ A: inspector ~~~\n") +
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"))
2019 Aug 19
1
class() bug when used within a validity method
Hi, This is a long-standing bug where 'class(object)' does not return the actual class of 'object' when used inside a validity method. Instead it seems to return the class for which the validity method is defined. For example: setClass("A", slots=c(stuff="ANY")) setValidity("A", function(object) { cat("validating an object of
2003 Nov 19
2
Was: setValidity and "initialize" method conflict ? [in R-help]
Hello, Thomas Stabla (statho3@web.de) has already sent this question to R-help, Wed, 12 Nov 2003 21:21:31 +0100, but we are not sure whether we should better post this mail to this audience than to R-help: --------------------------------------------------------------------- We are using S4-classes and want to force a validity check when an object is created. How can this be done, when an