From Matthias.Kohl at stamats.de  Tue Jan  3 18:06:30 2006
From: Matthias.Kohl at stamats.de (Matthias Kohl)
Date: Tue, 03 Jan 2006 18:06:30 +0100
Subject: [Rd] S4 default initialization: unwanted NULL
In-Reply-To: <m2bqytfgv7.fsf@ziti.local>
References: <m2bqytfgv7.fsf@ziti.local>
Message-ID: <43BAAF16.7030204@stamats.de>

you might need a call to "setOldClass"; see Section "Register or 
Convert?" of the corresponding help page.

Matthias

Seth Falcon schrieb:

>The default initialization for slots of class "factor" and
>"data.frame" gives NULL.  This seems odd, since those slots can't ever
>be set to NULL by the user.  I would expect zero-length instances of
>factor and data.frame.
>
>Here is an example:
>
>setClass("FOO", representation(a="factor", b="data.frame", c="numeric"))
>[1] "FOO"
>  
>
>>ff <- new("FOO")
>>ff
>>    
>>
>An object of class "FOO"
>Slot "a":
>NULL
>
>Slot "b":
>NULL
>
>Slot "c":
>numeric(0)
>
>
>sessionInfo()
>R version 2.3.0, 2005-12-26, powerpc-apple-darwin8.3.0 
>
>attached base packages:
>[1] "tools"     "methods"   "stats"     "graphics"  "grDevices" "utils"    
>[7] "datasets"  "base"     
>
>
>Slot c is initialized as I was expecting.
>
>+ seth
>
>______________________________________________
>R-devel at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-devel
>  
>


-- 
StaMatS - Statistik + Mathematik Service
Dipl.Math.(Univ.) Matthias Kohl
Gottlieb-Keim-Stra?e 60
95448 Bayreuth
Phone: +49 921 50736 457
E-Mail: matthias.kohl at stamats.de
www.stamats.de



[Rd] S4 default initialization: unwanted NULL
Matthias Kohl