Re: [R] Extending a data frame with S4

From: Matthias Kohl <Matthias.Kohl_at_stamats.de>
Date: Tue 03 Jan 2006 - 22:36:06 EST

the help page on "setOldClass" might help you. In particular the section "Register or Convert?".

Matthias

hadley wickham schrieb:

>I'm trying to create an extension to data.frame with more complex row
>and column names, and have run into some problems:
>
>
>
>>setClass("new-data.frame", representation("data.frame"))
>>
>>
>[1] "new-data.frame"
>Warning message:
>old-style ('S3') class "data.frame" supplied as a superclass of
>"new-data.frame", but no automatic conversion will be peformed for S3
>classes in: .validDataPartClass(clDef, name)
>
>Do I need to be worried about this?
>
>
>
>>new("new-data.frame", data.frame())
>>
>>
>Error in initialize(value, ...) : initialize method returned an object
>of class "data.frame" instead of the required class "new-data.frame"
>
>I guess this is related to the warning above. I presume I can fix
>this with an initialize function, but I'm not sure how to go about
>referring to the data frame that is the object.
>Is there a way to extend a data.frame, or do I need to create an
>object that contains the data frame in a slot?
>
>Thanks for your help,
>
>Hadley
>
>______________________________________________
>R-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>

-- 
StaMatS - Statistik + Mathematik Service
Dipl.Math.(Univ.) Matthias Kohl
www.stamats.de

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Tue Jan 03 22:42:42 2006

This archive was generated by hypermail 2.1.8 : Wed 04 Jan 2006 - 00:35:02 EST