[R] classes with chron slots

Martin Maechler maechler at stat.math.ethz.ch
Thu Jun 23 10:12:06 CEST 2005


>>>>> "Sebastian" == Sebastian Luque <spluque at 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.

Martin Maechler, ETH Zurich




More information about the R-help mailing list