vz33 setClass("tst",representation(mat="matrix", Distmat="dist")) Build的时候警告: Warning: undefined slot classes in definition of "tst": Distmat(class "dist") 感觉应该先继承dist类,如何实现?谢谢。
vz33 多谢。 不过cos的活跃度的确没有so高啊。 ref: http://stackoverflow.com/questions/27565535/how-to-make-a-class-of-slot-for-a-s4-class-as-dist
vz33 又有新问题哈。document()时报错了: Error: Failure in roxygen block beginning tst-class.R:27 Missing name 27为setOldClass("dist")
vz33 代码大致(slot部分有删除)如下: #' An S4 class. #' #' @slot mat Either a numeric matrix. #' @slot Distmat the distance matrix. #' @exportClass tst setOldClass("dist") setClass("tst", slots= list(mat="matrix", Distmat="dist")) 问题应该是这里有两个Class。