Re: [Rd] slots of type "double"

From: Simon Urbanek <>
Date: Tue, 13 Nov 2007 09:23:53 -0500

On Nov 13, 2007, at 3:36 AM, 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.

Simon mailing list Received on Tue 13 Nov 2007 - 14:37:00 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 13 Nov 2007 - 16:30:18 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.