[Rd] S4 default initialization: unwanted NULL
Seth Falcon
sfalcon at fhcrc.org
Tue Jan 3 19:39:13 CET 2006
On 3 Jan 2006, jmc at r-project.org wrote:
> It's legal to have virtual classes as slots, but yes, the slot is
> NULL in the prototype for the new class, unless the user specifies a
> value. In your case, providing a non-null prototype for the
> data.frame slot might be the desired solution.
Yes, that's a workaround.
> There is no S4 "initialization" for S3 classes; in fact, it's
> generally an error to use new() on them (or on other virtual
> classes).
The "basic vector classes" (see man page for new) can be created
with new(). From my perspective it would be more consistent if
data.frame and factor behaved similarly.
I admit that I don't understand why data.frame and factor are virtual
classes and don't know what would be involved to have new() work for
data.frame and factor.
+ seth
More information about the R-devel
mailing list