>>>>> "PaulG" == Paul Gilbert <pgilbert_at_bank-banque-canada.ca>
>>>>> on Sun, 04 May 2008 21:46:18 -0400 writes:
PaulG> Prof Brian Ripley wrote:
PaulG> It seems to happen in locales UTF-8, POSIX and C. I have not tried others.
>> I'm not sure what the issue being asked about here is. The peculiar
>> printing I don't see and may well be a locale issue. (Is this UTF-8 and
>> TeX has not been told so?)
>>
>> The other issue is that when printing an object with attributes, there
>> is no consideration of S4 classes amongst the attributes. That was
>> either an undocumented design decision or an omission. This is
>> different from
>>
>>> print(attributes(zz))
>> $tsp
>> [1] 1 10 1
>>
>> $class
>> [1] "ts"
>>
>> $Meta
>> An object of class “TSmetax”
>> Slot "serIDs":
>> [1] "whatever"
>>
>> Slot "ExtractionDate":
>> NULL
>>
>> since although attributes are internally a pairlist and printed by a
>> special C function, attributes() returns a list.
>>
>> It would be fairly easy to include a branch for S4 objects, but there
>> are ambuiguities still over what they are (I wrote up a set of questions
>> over a year ago about this). But it would seem fairly safe to send them
>> to show() in the same circumstances that autoprinting does for
>> apparently S4 objects.
PaulG> Yes, I do have the impression that print() does not do exactly what one
PaulG> might like when it finds an S4 attribute in an S3 object. I hope this is
PaulG> not a design decision. It would make it very difficult to migrate toward
PaulG> S4 if it is not possible to include S4 objects in S3 objects this way.
I'm pretty sure that this has *not* been a design decision, but rather an oversight till now.
To me, it seems even a "natural" oversight: If you are working for fully designed classes, it seems awkward to simultaneously use attributes of S3- (or "no class"-) objects. I do understand though that there can be situations, in particular migrations ones, where you want to do this ... and should be allowed to and should see print() working.
Martin
>> On Sun, 4 May 2008, Paul Gilbert wrote: >>
>>
>> My guess is that it was never intended that S4 objects be used as
>> attributes, in the same way that one of the unanswered questions is if S4
>> objects should be allowed to have attributes (other than slots).
>>
>>>> z <- new("TSmetax", serIDs="whatever", ExtractionDate= NULL)
>>>> print(z)
>>>> zz <- ts(1:10)
>>>> attr(zz, "Meta") <- z
>>>> print(zz)
>>>>
PaulG> ====================================================================================
PaulG> La version française suit le texte anglais.
PaulG> ------------------------------------------------------------------------------------
PaulG> This email may contain privileged and/or confidential information, and the Bank of
PaulG> Canada does not waive any related rights. Any distribution, use, or copying of this
PaulG> email or the information it contains by other than the intended recipient is
PaulG> unauthorized. If you received this email in error please delete it immediately from
PaulG> your system and notify the sender promptly by email that you have done so.
PaulG> ------------------------------------------------------------------------------------
PaulG> Le présent courriel peut contenir de l'information privilégiée ou confidentielle.
PaulG> La Banque du Canada ne renonce pas aux droits qui s'y rapportent. Toute diffusion,
PaulG> utilisation ou copie de ce courriel ou des renseignements qu'il contient par une
PaulG> personne autre que le ou les destinataires désignés est interdite. Si vous recevez
PaulG> ce courriel par erreur, veuillez le supprimer immédiatement et envoyer sans délai à
PaulG> l'expéditeur un message électronique pour l'aviser que vous avez éliminé de votre
PaulG> ordinateur toute copie du courriel reçu.
PaulG> ______________________________________________
PaulG> R-devel_at_r-project.org mailing list
PaulG> https://stat.ethz.ch/mailman/listinfo/r-devel
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 Mon 05 May 2008 - 12:31:25 GMT.
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.