Displaying 20 results from an estimated 75 matches for "setclassunion".
2020 Oct 05
2
S4 - inheritance changed by order of setClassUnion and setAs()
...t;mother" and "grandma".
setClass("grandma", slots = c(a = "character"))
setClass("mother", slots = c(b = "matrix"), contains = "grandma")
setClass("daughter", slots = c(c = "list"), contains = "mother")
setClassUnion(name = "mr_x", members = c("daughter", "mother"))
setAs(from = "daughter", to = "grandma", def = function(from) new("grandma"))
is(new("daughter"))
[1] "daughter" "mother" "mr_x" "grandma...
2020 Feb 18
2
Possible Regression in setClassUnion between 3.5.0 and 3.6.0
...lot ='character'))",
"setClass('y', slots = list(slot ='character'))",
"setClass('a', slots = list(slot ='character'))",
"setClass('b', slots = list(slot ='character'))",
"setClassUnion('xy', c('x', 'y'))",
"setClassUnion('ab', c('a', 'b'))",
"setClassUnion('xyab', c('xy', 'ab'))",
"setGeneric('f', function(object, ...) standardGeneric('f'))...
2006 Apr 12
1
yet another problem with S4 dispatch (with setClassUnion)
Dear John and Seth, dear R-devels,
once again the question of method dispatch in S4 -- this time with
setClassUnion(); taking up your advice in
https://stat.ethz.ch/pipermail/r-devel/2006-April/037200.html
https://stat.ethz.ch/pipermail/r-devel/2006-April/037201.html
I have been too quick in stating that
>setClassUnion()---at least in my case---solves the problem;
>
The problem arises if I have a direc...
2004 Oct 14
2
setClassUnion
Hello,
I have a question concerning "setClassUnion".
I'm working with R 2.0.0 Patched (2004-10-06) on windows 2000.
I tried to use "setClassUnion" in a package I am currently working on. The
situation is similar to the following example:
The DESCRIPTION file has entries:
Depends: R (>= 2.0.0), methods
Imports: methods...
2004 Oct 14
2
setClassUnion
Hello,
I have a question concerning "setClassUnion".
I'm working with R 2.0.0 Patched (2004-10-06) on windows 2000.
I tried to use "setClassUnion" in a package I am currently working on. The
situation is similar to the following example:
The DESCRIPTION file has entries:
Depends: R (>= 2.0.0), methods
Imports: methods...
2020 Oct 06
0
S4 - inheritance changed by order of setClassUnion and setAs()
Andreas,
As far as I can tell (/conjecture), this is because the list of classes a
particular class inherits from directly is appended to as needed, and so
the order that a class extends others isd refined by the order that those
connections are defined.
We can see this with two setClassUnion calls, rather than required setAs:
> setClass("grandma", slots = c(a = "character"))
> setClass("mother", slots = c(b = "matrix"), contains = "grandma")
> setClass("daughter", slots = c(c = "list"), contains = "m...
2020 Feb 19
2
Possible Regression in setClassUnion between 3.5.0 and 3.6.0
..."setClass('y', slots = list(slot ='character'))",
> > "setClass('a', slots = list(slot ='character'))",
> > "setClass('b', slots = list(slot ='character'))",
> > "setClassUnion('xy', c('x', 'y'))",
> > "setClassUnion('ab', c('a', 'b'))",
> > "setClassUnion('xyab', c('xy', 'ab'))",
> > "setGeneric('f', function(object, ....
2009 Feb 11
1
setClassUnion with numeric; extending class union
...good way to create an S4 class that would extend
numeric, but would allow NULL instead of data as well. As far as I can
see there is no way at the moment to do that, but please correct me if I
am wrong. The best solution I came up with so far was the following (it
also indicates a problem of using setClassUnion with numeric as one of
the classes):
I define a class union of numeric and NULL:
Unfortunately the following works only with warnings:
setClassUnion("numericOrNULL", c("numeric","NULL"))
So I do a workaround as:
setClass("aNumeric", contains="numeric...
2020 Feb 18
0
Possible Regression in setClassUnion between 3.5.0 and 3.6.0
...))",
> "setClass('y', slots = list(slot ='character'))",
> "setClass('a', slots = list(slot ='character'))",
> "setClass('b', slots = list(slot ='character'))",
> "setClassUnion('xy', c('x', 'y'))",
> "setClassUnion('ab', c('a', 'b'))",
> "setClassUnion('xyab', c('xy', 'ab'))",
> "setGeneric('f', function(object, ...) standardGen...
2020 Sep 23
3
Is it possible to simply the use of NULL slots (or at least improve the help files)?
As far as I can tell, there's no trivial way to set arbitrary S4 slots to NULL.
Most of the online examples I can find, use setClassUnion and are
about 10 years old.
Which, in my opinion, is defective.
There's nothing "robust" about making something that should be
trivially simple, really complicated.
Maybe there is a simpler way, and I just haven't worked it out, yet.
But either way, could the documentation for th...
2020 Feb 25
0
Possible Regression in setClassUnion between 3.5.0 and 3.6.0
...setClass('y', slots = list(slot ='character'))",
> > > "setClass('a', slots = list(slot ='character'))",
> > > "setClass('b', slots = list(slot ='character'))",
> > > "setClassUnion('xy', c('x', 'y'))",
> > > "setClassUnion('ab', c('a', 'b'))",
> > > "setClassUnion('xyab', c('xy', 'ab'))",
> > > "setGeneric('f', fun...
2020 Feb 26
1
Possible Regression in setClassUnion between 3.5.0 and 3.6.0
...', slots = list(slot ='character'))",
> > > > "setClass('a', slots = list(slot ='character'))",
> > > > "setClass('b', slots = list(slot ='character'))",
> > > > "setClassUnion('xy', c('x', 'y'))",
> > > > "setClassUnion('ab', c('a', 'b'))",
> > > > "setClassUnion('xyab', c('xy', 'ab'))",
> > > > "setGeneric(&...
2016 Mar 19
2
unary class union of an S3 class
...> <hpages at fredhutch.org <mailto:hpages at fredhutch.org>
> <mailto:hpages at fredhutch.org <mailto:hpages at fredhutch.org>>> wrote:
>
> Hi,
>
> Short story
> -----------
>
> setClassUnion("ArrayLike", "array")
>
> showClass("ArrayLike") # no slot
>
> setClass("MyArrayLikeConcreteSubclass",
> contains="ArrayLike",
> representation(stuff="AN...
2006 Oct 06
1
class unions?
the code below has me confused:
setClassUnion("index", c("numeric", "character", "logical"))
extends("numeric") # i don't see the class union
library(Matrix)
extends("numeric") # now i see the class union
i am aware that the "Matrix" package separately defines the &q...
2016 Mar 19
2
unary class union of an S3 class
On 03/18/2016 03:28 PM, Michael Lawrence wrote:
>
> On Fri, Mar 18, 2016 at 2:53 PM, Herv? Pag?s <hpages at fredhutch.org
> <mailto:hpages at fredhutch.org>> wrote:
>
> Hi,
>
> Short story
> -----------
>
> setClassUnion("ArrayLike", "array")
>
> showClass("ArrayLike") # no slot
>
> setClass("MyArrayLikeConcreteSubclass",
> contains="ArrayLike",
> representation(stuff="ANY")
> )
>
>...
2020 Sep 24
0
Is it possible to simply the use of NULL slots (or at least improve the help files)?
...quot;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
setClassUnion("character_OR_NULL", c("character", "NULL"))
.A = setClass("A", slots = c(x = "character_OR_NULL"))
with
> .A(x = NULL)
An object of class "A"
Slot "x":
NULL
> .A(x = month.abb)
An object of class "A"
Slot &q...
2016 Mar 18
2
unary class union of an S3 class
Hi,
Short story
-----------
setClassUnion("ArrayLike", "array")
showClass("ArrayLike") # no slot
setClass("MyArrayLikeConcreteSubclass",
contains="ArrayLike",
representation(stuff="ANY")
)
showClass("MyArrayLikeConcreteSubclass") # 2 slots!!...
2016 Mar 19
0
unary class union of an S3 class
...<mailto:hpages at fredhutch.org>
>> <mailto:hpages at fredhutch.org <mailto:hpages at fredhutch.org>>>
>> wrote:
>>
>> Hi,
>>
>> Short story
>> -----------
>>
>> setClassUnion("ArrayLike", "array")
>>
>> showClass("ArrayLike") # no slot
>>
>> setClass("MyArrayLikeConcreteSubclass",
>> contains="ArrayLike",
>> repre...
2019 Nov 11
2
Troubles using numeric in s4 class union
...ric class, but could not using
integers. Steps to reproduce the problem:
library(Matrix)
# this class has *nothing* to do with Matrix
setClass("MyClass",
representation(myvalue = "numeric"),
prototype(myvalue = NA_real_))
# this class also has nothing to do with Matrix
setClassUnion("NumOrMyClass", c("numeric", "MyClass"))
# this is to demonstrate creating and subsetting a specific Matrix
m <- new("dgCMatrix", i = c(2L, 0L, 1L, 2L, 0L, 1L), p = c(0L, 1L, 2L, 4L,
4L, 6L),
Dim = c(3L, 5L), Dimnames = list(NULL, NULL), x = c(2, 1, 2...
2012 Mar 15
1
Extending a group of S4 classes by setClassUnion ?
...etMethod("get.par","Extension",function(object){get.par(object at person)})
Is there any simpler solution by steClassUnion, setAs, setIs .... ?
Thanks a lot in advance
Alexander
--
View this message in context: http://r.789695.n4.nabble.com/Extending-a-group-of-S4-classes-by-setClassUnion-tp4475251p4475251.html
Sent from the R help mailing list archive at Nabble.com.