Roberto Brunelli <[EMAIL PROTECTED]> writes:
> I'm using an S4 object with a slot of type 'call': I would like to
> be able to initialize it with something like NULL or NA (indicating
> that there is no information in the slot) but the value should
> comply with the fact that it must be of type call.
>
> Is there any simple way to obtain this?
One possibility is to create a NullCall class:
setClass("NullCall", contains="call")
This can be put into a slot of type 'call' and identified by its
class. One advantage of this is that you can write a few methods for
NullCall and in many cases avoid explicit tests like:
if (class(obj) == "NullCall") ... else ...
For example, you could define a show metho that printed 'NULL' or
something.
It is also possible to define a class union and use that as the slot
type. I don't like this solution, but YMMV.
+ seth
--
Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center
http://bioconductor.org
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.