我以高级方式使用R相当陌生...因此为无用的问题表示歉意!我想创建一个S4类的对象,该对象由3个插槽定义。问题是我无法将这些属性创建为列表。这是我的代码:
test<-setClass("dblist",representation(df.list="list", df.para="list",df.coups="list"))
new("dblist",representation(df.list="list", df.para="list",df.coups="list"))
和我得到的错误:
Error in initialize(value, ...) : cannot use object of class “list” in new(): class
“dblistpgn” does not extend that class
您能否解释一下如何使用列表图创建对象?谢谢!
试试这个:
new("dblist", df.list = list(), df.para = list(), df.coups = list())
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句