Jor*_*eys 4 r class definition s4
我有一些麻烦从S4类定义中识别出来自旧包的类.我继续得到错误
Error in makePrototypeFromClassDef(properties, ClassDef, immediate, where) :
in making the prototype for class "Tsvmm" elements of the prototype failed to
match the corresponding slot class: dates (class "dates" )
In addition: Warning message:
undefined slot classes in definition of "Tsvmm": dates(class "dates")
Run Code Online (Sandbox Code Playgroud)
一个可重复的例子:
require(chron)
setClass(
Class="Tsvmm",
representation=representation(
data = "data.frame",
dates = "dates"
),
prototype=prototype(
data = data.frame(),
dates = chron(0)
)
)
Run Code Online (Sandbox Code Playgroud)
尝试时class(chron(0)),答案是"dates" "times".使用is.numeric(chron(0)),答案是TRUE.然而,当我将插槽日期类设置为时"numeric",我得到相同的错误而没有警告消息.
我觉得我忽略了一些明显的东西,但我还没有在文档中找到它.有人指点吗?
PS:我知道chron包装至少是特殊的,但我有充分的理由使用它.另外,其他包可能会出现问题.将此视为一般问题的示例.所以,请不要告诉我使用Date或POSIXt类.那是我现在正在使用的黑客.