Re: [R] classes with chron slots

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Thu 23 Jun 2005 - 22:20:44 EST

On 6/23/05, Martin Maechler <maechler@stat.math.ethz.ch> wrote:
> >>>>> "Sebastian" == Sebastian Luque <spluque@gmail.com>
> >>>>> on Wed, 22 Jun 2005 15:50:50 -0500 writes:
>
> Sebastian> I'd like to define a class with a chron slot, but:
> R> require(chron)
> R> setClass("myclass", representation(datetime = "chron"))
> Sebastian> [1] "myclass"
> Sebastian> Warning message:
> Sebastian> undefined slot classes in definition of "myclass": datetime(class "chron")
> Sebastian> in: .completeClassSlots(ClassDef, where)
>
> Sebastian> How should such a class be defined?
>
> You need to first make "chron" into a (pseudo-) S4 class,
> using setOldClass()
>
> Then you can extend it or use it as slot class.
>

Also if you are referring to the chron package then the names of the chron classes are 'dates' and 'times' -- not 'chron'.

R> library(chron)
R> example(chron)
...snip...
R> class(dts)
[1] "dates" "times"



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 Thu Jun 23 22:25:25 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:58 EST