Displaying 4 results from an estimated 4 matches for "character_or_nul".
Did you mean:
character_or_null
2020 Sep 24
2
Is it possible to simply the use of NULL slots (or at least improve the help files)?
Hi Martin,
Thankyou for your response.
I suspect that we're not going to agree on the main point.
Making it trivially simple (as say Java) to set slots to NULL.
So, I'll move on to the other points here.
***Note that cited text uses excerpts only.***
> setClassUnion("character_OR_NULL", c("character", "NULL"))
> A = setClass("A", slots = c(x = "character_OR_NULL"))
I think the above construct needs to be documented much more clearly.
i.e. In the introductory and details pages for S4 classes.
This is something that many people w...
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
2020 Sep 24
0
Is it possible to simply the use of NULL slots (or at least improve the help files)?
...; 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 "x":
[1] "...
2020 Sep 24
0
Is it possible to simply the use of NULL slots (or at least improve the help files)?
...Thankyou for your response.
I suspect that we're not going to agree on the main point.
Making it trivially simple (as say Java) to set slots to NULL.
So, I'll move on to the other points here.
***Note that cited text uses excerpts only.***
> setClassUnion("character_OR_NULL", c("character", "NULL"))
> A = setClass("A", slots = c(x = "character_OR_NULL"))
I think the above construct needs to be documented much more clearly.
i.e. In the introductory and details pages for S4 classes.
This is something th...