On Nov 13, 2007, at 3:36 AM, hpages at fhcrc.org wrote:
> Any idea why S4 doesn't allow slots of type "double"?
>
Type (as in storage type and "double" is a storage type) has nothing
to do with classes. You cannot create slots for types, only for classes.
>> setClass("A", representation(a="double"))
> Error in makePrototypeFromClassDef(properties, ClassDef, immediate,
> where) :
> in making the prototype for class "A" elements of the
prototype
> failed to
> match the corresponding slot class: a (class ?double? )
>
> "numeric", "integer", "character",
"complex", "raw", etc... they all
> work but "double" doesn't. Any reason for this strange
exception?
>
AFAICS there is no way to create an object of the class "double" (save
for 'faking' it by creating an informal S3 object), so such definition
is useless. And given this fact, even the internal code is unable to
create it, so it doesn't match the signature. Note:
> a=new("double")
> class(a)
[1] "numeric"
> is(a,"double")
[1] FALSE
I think it comes from the fact that there is an S4 definition for the
class "double" which is not valid. That is probably a bug and the
class definition should be removed.
Cheers,
Simon