Displaying 20 results from an estimated 10000 matches similar to: "S4 non-virtual class with no slots? [SOLVED]"
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
2005 Aug 18
2
Use of contains in S4 classes
setClass("B", representation=representation("B", extra="numeric))
setClass("B", representation=representation(extra="numeric"),
contains="B")
Are these the same? If not, how do they differ?
What about
setClass("B", representation=representation("B", extra="numeric"),
contains="B")
?
As far as I can
2006 Feb 07
0
S4 documentation
1. promptClass generated a file that included
\section{Methods}{
No methods defined with class "mspathDistributedCalculator" in the
signature.
}
Yet there are such methods. Is this a not-working yet feature, or is
something funny going on (maybe I have definitions in the library and in
the global workspace...)?
2. Is the \code{\link{myS4class-class}} the proper way to
cross-reference a
2009 Nov 25
1
group generics
I have classes A and B, where B contains A. In the implementation of
the group generic for B I would like to use the corresponding group
generic for A. Is there a way to do that?
I would also appreciate any comments if what I'm trying to do seems like
the wrong approach.
Here's a stripped down example:
setClass("A",
2015 May 28
0
S4 inheritance and old class
On 05/28/2015 02:49 AM, Julien Id? wrote:
> 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
2005 Jun 04
3
How to change the value of a class slot
I defined an S4 class with a slot i. Then I wrote a regular function
that attempted to increment i.
This didn't work, apparently because of the general rule that a function
can't change the values of its arguments outside the function. I gather
there are ways around it, but the Green book admonishes "cheating on the
S evaluation model is to be avoided" (p. 190).
Thinking that
2015 May 12
1
S4 method dispatch sometimes leads to incorrect when object loaded from file?
>>>>> Martin Morgan <mtmorgan at fredhutch.org>
>>>>> on Mon, 11 May 2015 10:18:07 -0700 writes:
> On 05/10/2015 08:19 AM, Martin Morgan wrote:
>> Loading an S4 object from a file without first loading the library sometimes (?,
>> the example below and actual example involves a virtual base class and the show
>> generic)
2006 Nov 24
1
Missing values for S4 slots
Using R 2.4, the following fails:
setClass("testc", representation(a="ANY"))
makeC <- function(myarg) new("testc", a=myarg)
makeC()
-> Error in initialize(value, ...) : argument "myarg" is missing,
with no default
On the other hand, this is OK:
f <- function(a) g(b=a)
g <- function(b) if(missing(b)) "missing" else "valid
2013 May 08
1
Namespace/inheritance problem in S4 methods for a union class
Hi,
I started this post on bioc-devel but this seems to be more general:
https://stat.ethz.ch/pipermail/bioc-devel/2013-May/004311.html
See reproducible example from Martin below.
Thank you.
Renaud
---------- Forwarded message ----------
From: Martin Morgan <mtmorgan at fhcrc.org>
Date: 7 May 2013 19:55
Subject: Re: [Bioc-devel] ExpressionSet and LumiBatch: inheritance problem
in S4
2015 May 11
0
S4 method dispatch sometimes leads to incorrect when object loaded from file?
On 05/10/2015 08:19 AM, Martin Morgan wrote:
> Loading an S4 object from a file without first loading the library sometimes (?,
> the example below and actual example involves a virtual base class and the show
> generic) leads to incorrect dispatch (to the base class method).
>
> The attached package reproduces the problem. It has
The package was attached but stripped; a version is
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
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(...)
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 =
2015 May 10
2
S4 method dispatch sometimes leads to incorrect when object loaded from file?
Loading an S4 object from a file without first loading the library sometimes (?,
the example below and actual example involves a virtual base class and the show
generic) leads to incorrect dispatch (to the base class method).
The attached package reproduces the problem. It has
setClass("A")
setClass("B", contains="A")
setMethod("show", "A",
2018 Mar 13
0
Possible Improvement to sapply
Quite possibly, and I?ll look into that. Aside from the work I was doing, however, I wonder if there is a way such that sapply could avoid the overhead of having to call the identical function to determine the conditional path.
From: William Dunlap [mailto:wdunlap at tibco.com]
Sent: Tuesday, March 13, 2018 12:14 PM
To: Doran, Harold <HDoran at air.org>
Cc: Martin Morgan <martin.morgan
2012 Dec 08
1
namespace S3 and S4 generic imports cannot both be satisfied:
PkgA wishes to write a method for 'unique' on S4 class 'A'. ?Methods indicates
that one should
setGeneric("unique")
setClass("A")
unique.A <- function(x, incomparables=FALSE, ...) {}
setMethod(unique, "A", unique.A)
Both S3 and S4 methods need to be exported in the NAMESPACE
import(methods)
S3method(unique, A)
2020 Sep 24
0
Is it possible to simply the use of NULL slots (or at least improve the help files)?
I did ?"NULL<tab> at the command line and was lead to ?"NULL-class" and the BasicClasses help page in the methods package.
getClass("NULL"), getClass("character") show that these objects are unrelated, so a class union is the way to define a class that is the union of these. The essence of the behavior you would like is
2012 Oct 18
1
S4 fails to initialize linear hierarchies with intermediate VIRTUAL classes
Initialization of this simple hierarchy
A = setClass("A", representation(x="numeric"))
setClass("B", contains=c("VIRTUAL", "A"))
C = setClass("C", contains="B")
fails (neat that setClass returns generators; I hadn't realized that before!)
> C(A())
Error: evaluation nested too deeply: infinite recursion /
2007 Sep 12
1
"could not find function" in R CMD check
During R CMD check I get this:
** building package indices ...
Error in eval(expr, envir, enclos) : could not find function
"readingError"
Execution halted
ERROR: installing package indices failed
The check aborts there. readingError is a function I just added; for
reference
setClass("readingError", contains="matrix")
readingError <- function(...)